NewApplications
If you want to add test suites to an Ubuntu application that is not yet available in the framework you will need some python coding knowledge and should have some knowledge of the LDTP framework.
When adding a new Ubuntu application to the framework, you will need to edit the desktoptesting/ubuntu.py and the desktoptesting/ubuntu_constants.py files.
In the first one, add a new child class of Application, for the selected application, following the template below:
1 class <NameOfApplication>(Application):
2 """
3 Description of the class
4 """
5
6 def __init__(self):
7 Application.__init__(self, ubuntu_constants.<APP_WINDOW_NAME>)
8
9 def setup(self):
10 #setup code, self.open(), i.e.
11
12 def teardown(self):
13 #teardown code, self.exit(), i.e.
14
15 def cleanup(self):
16 # Add here what happens between test cases
17 pass
18
19 def open(self):
20 Application.open_and_check_app(self, ubuntu_constants.<LAUNCHER_NAME>)
21
22 def do_stuff(self, arg1, arg2):
23 """
24 Description of the method
25
26 @type arg1: <string, float, ...>
27 @param arg1: description of first argument
28
29 @type arg2: <string, float, ...>
30 @param arg2: description of second argument argument
31
32 """
33
34 application = ooldtp.context(self.name)
35
36 #insert here the ldtpcode
37
38 def do_other_stuff(self, arg1, arg2):
39 """
40 Description of the method
41
42 @type arg1: <string, float, ...>
43 @param arg1: description of first argument
44
45 @type arg2: <string, float, ...>
46 @param arg2: description of second argument argument
47
48 """
49
50 application = ooldtp.context(self.name)
51
52 #insert here the ldtpcode
All the constansts of the application, such as window titles, button names, etc. should go as strings to desktoptesting/ubuntu_constants.py, and should be referenced from there.
All the applications should have these methods:
init: It calls the parent's init method with the name of the window title for the new one.
setup: This will be called at the beggining of a test suite, but not between test cases within the same suite. Opening the application is a classic set up operation.
teardown: This will be called at the end of a complete test suite, but not between test cases within the same suite. Closing the application is a classic tear down operation.
cleanup: This will be called at the end of each test case. Write code that cleans up the mess introduced by a test case that could interfere with the next one.
- The rest of the methods will use ldtp calls to do common stuff with the application: write text, create documents, etc.
The test suites folder
When adding a new application to the framework, you should also create a new folder in the root ubuntu-desktop-testing folder called as the application name. This folder will be the container of the testsuites related to this application.
Please, refer to the document about creating new tests for more information about how to add new test suites to the new application.