Qbs

Blog Documentation Get Qbs
  • Qbs Manual
  • QbsConvenienceItems
  • AutotestRunner
  • Qbs 2.3.0
  • AutotestRunner QML Type

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

    Import Statement: import QbsConvenienceItems

    Properties

    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

    PoolSinceDescription
    "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: []


    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


    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.


    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