]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/doc/test_organization/test_enabling_disabling.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / doc / test_organization / test_enabling_disabling.qbk
CommitLineData
7c673cae
FG
1[/
2 / Copyright (c) 2003 Boost.Test contributors
3 /
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 /]
7
8[section:enabling Enabling or disabling test unit execution]
9
10The __UTF__ provides a way for enabling or disabling a test unit execution. If a test case is disabled, it will not be
11run by the test runner. If a test suite is disabled, its status is inherited by the test units under its subtree, unless
12otherwise specified.
13
14The run status can be overridden by the command line parameters: by providing the appropriate arguments to the command
15line, a disabled test may still be executed. The [link boost_test.runtime_config.test_unit_filtering test unit
16filtering] section covers this feature in details.
17
18[h3 Unconditional run status]
19Decorator __decorator_disabled__ indicates that the test unit's __default_run_status__ is ['false]. This means that that
20test cases inside this test unit will not be run by default, unless otherwise specified. Decorator __decorator_enabled__
21indicates that the test unit's default run status is ['true]. This means that that test cases inside this test unit will
22be run by default, unless otherwise specified.
23
24[bt_example decorator_05..decorators enabled and disabled..run-fail]
25
26Syntactically, it is possible to apply both decorators `enabled` and `disabled` to the same test unit. This is reported
27as set-up error when the test program is run.
28
29[h3 Compilation-time run status]
30
31Decorator __decorator_enable_if__ indicates that the test unit's __default_run_status__ is either ['true] or ['false],
32depending on the value of `Condition`. This means that that test cases inside this test unit will or will not be run by
33default.
34
35
36[bt_example decorator_06..decorator enable_if..run-fail]
37
38Decorator `enable_if<true>()` is equivalent to decorator `enabled()`. Similarly, `enable_if<false>()` is equivalent to
39decorator `disabled()`.
40
41[/-----------------------------------------------------------------]
42[h3 Runtime run status]
43
44Decorator __decorator_precondition__ associates a ['predicate] with a test unit. Before the test unit is executed, the
45predicate is evaluated with the test unit's ID passed as the argument. If it evaluates to `false`, execution of the test
46unit is skipped. Skipping the test suite means skipping the execution of every test unit inside.
47
48[bt_example decorator_08..decorator precondition..run-fail]
49
50In the example above, the user defined a custom predicate `if_either` that evaluates to `true` if at least one of the two
51specified tests passed. (It assumes that the tests are registered in the specific order.) Test case `test3` has a
52precondition that at either `test1` or `test2` passed. The precondition is satisfied, therefore `test3` is run (and
53fails). Test case `test4` has a precondition that either `test2` or `test3` passed. Since they both failed, the
54precondition is not satisfied, therefore `test4` is skipped.
55
56[endsect]