- Qt 6.8
- Qt Test
- Chapter 6: Skipping Tests with QSKIP
- Qt 6.8.3 Reference Documentation

Chapter 5

# Chapter 6: Skipping Tests with QSKIP

### Using QSKIP(description) in a test function

If the QSKIP() macro is called from a test function, it stops the execution of the test without adding a failure to the test log. It can be used to skip tests that are certain to fail. The text in the QSKIP description parameter is appended to the test log, and should explain why the test was not carried out.

QSKIP can be used to skip testing when the implementation is not yet complete or not supported on a certain platform. When there are known failures, QEXPECT_FAIL is recommended, as it supports running the rest of the test, when possible.

Example of QSKIP in a test function:

     if (tst_Databases::getMySqlVersion(db).section(QChar('.'), 0, 0).toInt() < 5)
         QSKIP("Test requires MySQL >= 5.0");

In a data-driven test, each call to QSKIP() skips only the current row of test data. If the data-driven test contains an unconditional call to QSKIP, it produces a skip message for each row of test data.

### Using QSKIP in a _data function

If called from a _data function, the QSKIP() macro stops execution of the _data function. This prevents execution of the associated test function.

See below for an example:

         QTest::addColumn<bool>("bool");
         QTest::newRow("local.1") << false;
         QTest::newRow("local.2") << true;

         QSKIP("skipping all");

### Using QSKIP from initTestCase() or initTestCase_data()

If called from `initTestCase()` or `initTestCase_data()`, the QSKIP() macro will skip all test and _data functions.

See also Select Appropriate Mechanisms to Exclude Tests.