If you want to add test suites to a GNOME 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 GNOME application to the framework, you will need to edit the mago/applications/gnome.py file.
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 # Constants that should be defined in the classes that inherit from this class 7 LAUNCHER = "" # Argument to be passed when launching the application through ldtp.launchapp 8 WINDOW = "" # Top application frame pattern using ldtp syntax 9 CLOSE_TYPE = "" # Close object type (one of 'menu' or 'button') 10 CLOSE_NAME = "" # Close object name 11 12 def __init__(self): 13 Application.__init__(self, gnome_constants.<APP_WINDOW_NAME>) 14 15 def setup(self): 16 #setup code, self.open(), i.e. 17 18 def teardown(self): 19 #teardown code, self.exit(), i.e. 20 21 def cleanup(self): 22 # Add here what happens between test cases 23 pass 24 25 def open(self): 26 Application.open_and_check_app(self, gnome_constants.<LAUNCHER_NAME>) 27 28 def do_stuff(self, arg1, arg2): 29 """ 30 Description of the method 31 32 @type arg1: <string, float, ...> 33 @param arg1: description of first argument 34 35 @type arg2: <string, float, ...> 36 @param arg2: description of second argument argument 37 38 """ 39 40 application = ooldtp.context(self.name) 41 42 #insert here the ldtpcode 43 44 def do_other_stuff(self, arg1, arg2): 45 """ 46 Description of the method 47 48 @type arg1: <string, float, ...> 49 @param arg1: description of first argument 50 51 @type arg2: <string, float, ...> 52 @param arg2: description of second argument argument 53 54 """ 55 56 application = ooldtp.context(self.name) 57 58 #insert here the ldtpcode
All the constants of the application, such as window titles, button names, etc. should be described as strings at the beginning of the class.
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.
- 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 mago 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.