A QUTest test script contains a group of related tests (a test group). The basic job of these tests is to send commands to the test fixture running in the Target and to compare the QSPY textual output produced by the Target with the test expectations.
The QUTest test scripts are executed in the host by the QUTest script runner that communicates with the QSPY host application via the UDP interface. The QUTest script runner is itself implemented in a Python module qutest.py.
The Python module qtools/qspy/py/qutest.py defines a small Domain Specific Language (DSL) for writing test scripts in Python. The structure of this DSL is very simple. Each test script consists of two sections:
The "preamble" section of a test script file specifies include scripts and defines callback functions common to all tests in this file. It can contain the following functions:
The on_...()
callback functions can call any of the test commands.
The "tests" section of a test script file contains the actual tests. Each test starts with the test() command and can contain any number of the test commands. The test continues until another test() command, or the skip() command.
The "tests" section can also contain test written in the more elaborate "BDD-style" (BDD stands for Behavior-Driven Development). Each BDD test starts with the @scenario() command and can contain any number of the test commands. The test continues until another @scenario() command, or the skip() command.
The commands that you can place in the tests (as well as inside the callback functions) are:
Commands that don't communicate with the Target: