QTools  8.0.1
Collection of Host-Based Tools
Loading...
Searching...
No Matches
QUTest™ Script Reference

QUTest™ Fixture ReferenceQView™ Visualization & Monitoring

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.

QUTest™ Testing DSL

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:

Preamble

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.

Tests

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.

BDD-Style Tests

The "tests" section can also contain tests written in the more structured "BDD-style" (BDD stands for Behavior-Driven Development). In this approach, tests are called "scenarios" and consist of sections: "given", "when", and "then".

QUTest supports two alternative ways of specifying the BDD scenarios.

Note
BDD-Style scenrios can be mixed with regular tests in the same test script, however a given scenario must consistently use the chosen BDD alternative.

The alternative #1 is based on the following group of commands, which you can simply mix with other QUTest commands:

The alternative #2 is based on the Python decorators, where every section of a scenario becomes a separate Python function. QUTest script can apply the following Python decorators:

Commands

The commands that you can place in the tests (as well as inside the callback functions) are:

Simple Commands:

Complex Commands:

Commands that don't communicate with the Target:

QUTest™ Fixture ReferenceQView™ Visualization & Monitoring