Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qttestlib-tutorial6.qdoc
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
4
5/*!
6 \page qttestlib-tutorial6.html
7
8 \previouspage {Chapter 5: Writing a Benchmark}{Chapter 5}
9
10 \title Chapter 6: Skipping Tests with QSKIP
11 \brief How to skip tests in certain cases.
12
13 \section2 Using QSKIP(\a description) in a test function
14
15 If the \l QSKIP() macro is called from a test function, it stops
16 the execution of the test without adding a failure to the test log.
17 It can be used to skip tests that are certain to fail. The text in
18 the QSKIP \a description parameter is appended to the test log,
19 and should explain why the test was not carried out.
20
21 QSKIP can be used to skip testing when the implementation is not yet
22 complete or not supported on a certain platform. When there are known
23 failures, \l QEXPECT_FAIL is recommended, as it supports running the rest
24 of the test, when possible.
25
26 Example of QSKIP in a test function:
27
28 \snippet code/doc_src_qtqskip_snippet.cpp 0
29
30 In a data-driven test, each call to QSKIP() skips only the current
31 row of test data. If the data-driven test contains an unconditional
32 call to QSKIP, it produces a skip message for each row of test data.
33
34 \section2 Using QSKIP in a _data function
35
36 If called from a _data function, the QSKIP() macro stops
37 execution of the _data function. This prevents execution of the
38 associated test function.
39
40 See below for an example:
41
42 \snippet code/doc_src_qtqskip.cpp 1
43
44 \section2 Using QSKIP from initTestCase() or initTestCase_data()
45
46 If called from \c initTestCase() or \c initTestCase_data(), the
47 QSKIP() macro will skip all test and _data functions.
48
49 \sa {Select Appropriate Mechanisms to Exclude Tests}
50*/