The objective of having written a framework for desktop testing automation in GNOME is to have a consistent way to write automated tests for all the GNOME applications. Furthermore, it makes it easier to write new and reusable tests for applications already available in the framework.
The gnome.py & gnome_constants.py
When adding a new application to the framework, a new class is created in gnome.py module, inheriting from Application.
Setup, Clean Up & Teardown
The TestSuite class (and all the rest of the applications that inherit from it) has 3 methods, needed for the test suite configuration: setup(), cleanup() and teardown().
- setup() is called once when the test suite starts running. It includes the operations needed in the application to leave it in a state where the test cases work.
- cleanup() is called between test cases in the same test suite. It includes the operations needed to leave the application in the same state as when the test suite started.
- teardown() is called once when the test suite ends. In includes the operations to leave the system in the same state as before running the suite (killing processes, closing applications, etc)
The Test Runner
Under the bin folder, the mago script, runs the test cases and parses the log.
Usage: mago [OPTIONS] Options: -h, --help show this help message and exit -l FILE, --log=FILE The file to write the log to. --log-level=LOG_LEVEL One of debug, info, warning, error or critical. -a APPLICATION, --application=APPLICATION Application name to test. Option can be repeated and defaults to all applications -s SUITE, --suite=SUITE Suite name to test within applications. Option can be repeated and default to all suites -f FILE, --file=FILE XML file name of the suite to test within applications. -t FILE, --target=FILE Target directory for logs and reports. Defaults to: ~/.mago
For example, to run all the seahorse tests run, from the mago root folder:
PYTHONPATH=. ./bin/mago -a seahorse
By default, logs go to ~/.mago, but it can be override using the -t option
It then runs the setup() method of the BaseClass, and start running each of the test cases.
After each testcase, it runs the suite cleanup() method, to leave the application in its initial state.
After running all the testcases in the suite, it will call the teardown() method, to close the application and leave the system as before.