19.8. Using QTest With the Groovy Backend

For simple QTest-based test suites, nothing unusual is required: just create your .test files in the qtest directory as always. If you are using QTest's coverage system, you can assign the names of the source files containing coverage calls to the TC_SRCS parameter, which abuild will automatically export to the environment. Abuild also automatically exports TESTS, so you can pass it on the abuild command line (e.g. abuild TESTS="one two" to run one.test and two.test) if you want to run a subset of your tests.

The easiest way to pass information from your build into your test suite is through environment variables. For example, you may need to pass in the path of a configuration file or JAR file so that your test suite can find it. To do this, you can create parameters containing those values and then append the names of the parameters to the qtest.export parameter. For each value in qtest.export, an upper-case version of the variable name is exported to the environment with the value returned by calling resolveAsString on that parameter. For example, if you had the following parameter block in your Abuild.conf:

parameters {
    TEST_CONFIG = 'test_config.xml'
    qtest.export << 'TEST_CONFIG'
    // other standard parameters ...

your test suites would be able to reference $ENV{'TEST_CONFIG'} to retrieve the value test-config.xml.