Product that runs all autotests in the project. More...


Detailed Description

An AutotestRunner has a dependency on all products with the type "autotest". Building the AutotestRunner product will then run the respective executables. The builtByDefault property is set to false by default, so running the autotests has to be explicitly requested. The default name of the product is "autotest-runner".

To use this feature:

  1. Attach the "autotest" type to your autotests:
    CppApplication {
        name: "tst_mytest"
        type: ["application", "autotest"]
        // ...
  2. Instantiate exactly one AutotestRunner in your project, typically at the top level:
    Project {
        // ...
        AutotestRunner { }
        // ...
  3. Trigger the autotest execution by building the product:
    qbs build -p autotest-runner

Setting Properties for individual Tests

To control the behavior of individual tests, some properties of the AutotestRunner can be overridden by depending on the autotest module and setting its properties:

CppApplication {
    name: "tst_mytest"
    type: ["application", "autotest"]

    Depends { name: "autotest" }

    autotest.timeout: 60

    // ...

Relevant Job Pools

"autotest-runner"1.15The job pool used to run the tests.

Property Documentation

arguments : stringList

The list of arguments to invoke the autotest with. A test can override this by setting the arguments property of the autotest module.

Default: []

[since Qbs 1.12] auxiliaryInputs : stringList

This property can contain arbitrary file tags. The AutotestRunner will get dependencies on all products whose type matches at least one of these tags, and invocation of the test executables will happen only after all of the respective artifacts have been built. Set this property if your test executables have run-time dependencies on other products.

Default: Undefined

This property was introduced in Qbs 1.12.

environment : stringList

A list of environment variables that are added to the run environment. They are provided as a list of strings in the form "varName=value".

Default: DYLD_LIBRARY_PATH, DYLD_FRAMEWORK_PATH, and DYLD_ROOT_PATH are set on macOS, or an empty list for other platforms.

limitToSubProject : bool

By default, only those autotests are considered that are in the same sub-project that AutotestRunner was instantiated in. If you want to run all autotests regardless of their location in the project hierarchy, set this property to false.

Default: true

[since Qbs 1.15] timeout : int

Time limit for the execution of the individual tests. If a test does not finish within the time limit, the test is cancelled and considered failed. A value below or equal to 0 means no timeout. A test can override this by setting the timeout property of the autotest module.

Default: -1

This property was introduced in Qbs 1.15.

[since Qbs 1.12] workingDir : string

If this property is set, it will be the working directory for all invoked test executables. Otherwise, the working directory will the the parent directory of the respective executable. A test can override this by setting the workingDir property of the autotest module.

Default: Undefined

This property was introduced in Qbs 1.12.

wrapper : stringList

Wrapper binary and its arguments for wrapping autotest calls. This is useful for tools like Valgrind and alike.

Default: empty

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.