App-Launching-Automation-Spec
Oxford Automation Sprint - 2009
Gnome Menu Application Launching
- Assignees
- cgregan
- jcollado
Specification for Automation
- Desktop
- Dynamically collect the applications in the gnome-menu
- Generate scripts based on the app names collected
- Execute generated scripts
- Report any failures in app launch
- Report any failure in app close
- Future
- Extend test depth to exercise more app functions
Problems found
- Accessibility information
UNR launcher doesn't provide accessibility information so it's not possible to automate the task of collecting all the applications for which there's an icon that might be clicked using LDTP. Bug#341048 has been opened, but this won't be fixed, at least in the short-term, because launcher is based on clutter, which doesn't provide any support to add accessibility information.
As an alternative, the desktop-switcher application has been tried to get the menu information from the standard ubuntu menu. Unfortunately this information is not available also in the version included in jaunty so this solution isn't acceptable for now.
The only feasible solution at the moment seems to be parsing .desktop files in /usr/share/applications using gnome-menus and call the applications using the Exec tag from those files to launch the application. This solution should work, but it must be noted that the automated tests won't check that the click action in the menu icons work. A simple script that will get the list of applications as explained is displayed below:
1 #!/usr/bin/python
2 """
3 Simple python script that shows how to get the list of currently
4 installed applications listed in the menu using gmenu
5 """
6 import sys, optparse, gmenu
7
8 def main(argv):
9 options = parse_options(argv)
10
11 tree = gmenu.lookup_tree(options.menu)
12 root = tree.root
13
14 applications = []
15 if isinstance(root, gmenu.Directory):
16 add_directory_apps(root, applications)
17
18 for app in applications:
19 print ("Name: '%s'\n"
20 "Exec: '%s'"
21 % (app.get_name(),
22 app.get_exec()))
23
24 def add_directory_apps(dir, apps):
25 """
26 Explore directories recursively and append every application found
27 in to the list of applications
28 """
29 contents = dir.get_contents()
30
31 for object in contents:
32 if isinstance(object, gmenu.Directory):
33 add_directory_apps(object, apps)
34 elif isinstance(object, gmenu.Entry):
35 apps.append(object)
36 else:
37 print >> sys.stderr, "Skipping %s" % object
38
39 def parse_options(argv):
40 parser = optparse.OptionParser()
41 parser.add_option('-m', '--menu',
42 default='applications.menu',
43 help=("Menu file to be used as root of the tree"
44 "('%default' by default)"))
45 (options, args) = parser.parse_args(argv)
46 return options
47
48
49 if __name__ == "__main__":
50 main(sys.argv)
Testing/Automation/OxfordSprint2009/App-Launching-Automation-Spec (last edited 2009-03-16 11:04:29 by 121)