This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

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().

The Test Runner

Under the bin folder, the mago script, runs the test cases and parses the log.

Syntax:

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

The classes that run the tests are TestSuiteRunner and TestCaseRunner:

testrunner.jpg

The TestSuite runner parses the XML file and creates an array of test cases to run. Please, read the document on how to create new test suites, to understand the syntax of the XML file.

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.


2024-10-23 11:37