2
0
mirror of https://github.com/boostorg/test.git synced 2026-02-16 13:52:11 +00:00
Files
test/doc/test_organization/reference.qbk
2015-01-10 12:51:35 +01:00

252 lines
8.4 KiB
Plaintext

[/
/ Copyright (c) 2003-2014 Gennadiy Rozental
/ Copyright (c) 2014 Raffi Enficiaud
/
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:test_org_reference Reference]
[table
[
[Macro]
[Short description]
]
[/ ###############################################################################################]
[/ Test cases]
[
[__BOOST_TEST_CASE__]
[Manual registration of a test case]
]
[
[__BOOST_AUTO_TEST_CASE__]
[Automatic declaration and registration of a test case]
]
[
[__BOOST_PARAM_TEST_CASE__]
[Automatic declaration and registration of a test case with a collection of parameters]
]
[
[__BOOST_AUTO_TEST_CASE_TEMPLATE__]
[Automatic declaration and registration of a typed test case]
]
[
[__BOOST_TEST_CASE_TEMPLATE__]
[Registration of a typed test case with an `boost::mpl` like sequence of types]
]
[
[__BOOST_TEST_CASE_TEMPLATE_FUNCTION__]
[Declaration of the body of a typed test case]
]
[
[__BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES__]
[Indicates the number of expected failures for a test case]
]
[
[__BOOST_DATA_TEST_CASE__]
[Declaration of the body of a test case on datasets]
]
[/ ###############################################################################################]
[/ Test suites]
[
[__BOOST_TEST_SUITE__]
[Manual creation of a test suite instance]
]
[
[__BOOST_AUTO_TEST_SUITE__]
[Automatic declaration of a test suite]
]
[
[__BOOST_AUTO_TEST_SUITE_END__]
[Automatic declaration of a test suite]
]
[/ ###############################################################################################]
[/ Decorator]
[
[__BOOST_TEST_DECORATOR__]
[Adds decorators to a test unit]
]
[/ ###############################################################################################]
[/ Fixtures]
[
[__BOOST_FIXTURE_TEST_CASE__]
[Declares a test case with a fixture]
]
[
[__BOOST_FIXTURE_TEST_SUITE__]
[Declares a fixture for a test suite (the setup/teardown is called for each test of the test suite)]
]
[
[__BOOST_GLOBAL_FIXTURE__]
[Declares a fixture globally to the test module]
]
]
[/ Test cases ###############################################################################################]
[section:test_org_boost_test_case `BOOST_TEST_CASE`]
Creates a test case for manual registration. The registration in the test tree should be performed manually.
See [link ref_BOOST_TEST_CASE here] for more details.
[endsect] [/section:test_org_boost_test_case]
[section:test_org_boost_auto_test_case `BOOST_AUTO_TEST_CASE`]
Declares and registers automatically a test case.
See [link ref_BOOST_AUTO_TEST_CASE here] for more details.
[endsect] [/section:test_org_boost_auto_test_case]
[section:test_org_boost_test_case_expected_failure `BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES`]
Indicates the number of failures for a test case.
See [link ref_BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES here] for more details.
[endsect] [/section:test_org_boost_test_case_expected_failure]
[section:test_org_boost_test_case_auto_template `BOOST_AUTO_TEST_CASE_TEMPLATE`]
Declares and registers automatically a typed test case.
See [link ref_BOOST_AUTO_TEST_CASE_TEMPLATE here] for more details.
[endsect] [/section:test_org_boost_test_case_auto_template]
[section:test_org_boost_test_case_template `BOOST_TEST_CASE_TEMPLATE`]
Creates a typed test case. The test case should have been declared with the macro __BOOST_TEST_CASE_TEMPLATE_FUNCTION__.
The registration in the test tree should be performed manually.
See [link ref_BOOST_TEST_CASE_TEMPLATE here] for more details.
[endsect] [/section:test_org_boost_test_case_template]
[section:test_org_boost_test_case_template_function `BOOST_TEST_CASE_TEMPLATE_FUNCTION`]
Declares a typed test case. The registration in the test tree should be performed manually, using the macro
__BOOST_TEST_CASE_TEMPLATE__.
See [link ref_BOOST_TEST_CASE_TEMPLATE here] for more details.
[endsect] [/section:test_org_boost_test_case_template_function]
[section:test_org_boost_test_case_parameter `BOOST_PARAM_TEST_CASE`]
Declares and registers automatically a test case with one parameter.
See [link boost_test.users_guide.tests_organization.test_cases.param_test here] for more details.
[endsect] [/section:test_org_boost_test_case_parameter]
[section:test_org_boost_test_dataset `BOOST_DATA_TEST_CASE`]
Declares and registers a data-driven test case, using a particular dataset.
Several forms of the macro are available.
``
BOOST_DATA_TEST_CASE(test_case_name, dataset)
{
BOOST_TEST(sample != 0);
}
``
should be used for datasets with arity 1. In the body of the test case, the samples of the dataset are taken by the variable `sample`.
``
BOOST_DATA_TEST_CASE(test_case_name, dataset, var1)
{
BOOST_TEST(var1 != 0);
}
``
same as the first form, but the samples are taken by the variable `var1` instead of the variable `sample`
``
BOOST_DATA_TEST_CASE(test_case_name, dataset, var1, var2..., varN)
{
BOOST_TEST(var1 != 0);
//...
BOOST_TEST(varN != 0);
}
``
same as the second form, but for dataset of arity `N`.
See [link boost_test.users_guide.tests_organization.test_cases.test_case_generation.datasets_auto_registration here] for more details.
[endsect] [/section:test_org_boost_test_dataset]
[/ Test suites ###############################################################################################]
[section:test_org_boost_test_suite `BOOST_TEST_SUITE`]
Creates a test suite. The created test suite should be added to the test tree manually.
See [link ref_BOOST_TEST_SUITE here] for more details.
[endsect] [/section:test_org_boost_test_suite]
[section:test_org_boost_auto_test_suite `BOOST_AUTO_TEST_SUITE`]
Indicates the beginning of a test suite. Test suites can be nested.
See [link ref_BOOST_AUTO_TEST_SUITE here] for more details.
[endsect] [/section:test_org_boost_auto_test_suite]
[section:test_org_boost_auto_test_suite_end `BOOST_AUTO_TEST_SUITE_END`]
Indicates the end of a test suite. Test suites can be nested. This macro should appear as many times as there is a
__BOOST_AUTO_TEST_SUITE__.
See [link ref_BOOST_AUTO_TEST_SUITE here] for more details.
[endsect] [/section:test_org_boost_auto_test_suite_end]
[/ Decorator ##############################################################################################]
[section:test_org_boost_test_decorator `BOOST_TEST_DECORATOR`]
Defines ['decorators] for a test unit.
See [link ref_BOOST_TEST_DECORATOR here] for more details.
[endsect] [/section:test_org_boost_test_decorator]
[/ Fixtures ###############################################################################################]
[section:test_org_boost_test_case_fixture `BOOST_FIXTURE_TEST_CASE`]
Declares and registers a test case that uses a fixture. The class implementing the fixture should have the appropriate
[link boost_test.users_guide.tests_organization.fixtures.model interface].
As any fixture, it is possible to have test assertions in the fixture class.
See [link boost_test.users_guide.tests_organization.fixtures.case here] for more details.
[endsect] [/section:test_org_boost_test_case_fixture]
[section:test_org_boost_test_suite_fixture `BOOST_FIXTURE_TEST_SUITE`]
Declares and registers a test suite that uses a fixture. Each test case in the test suite uses the fixture.
The class implementing the fixture should have the appropriate [link boost_test.users_guide.tests_organization.fixtures.model interface].
As any fixture, it is possible to have test assertions in the fixture class.
See [link boost_test.users_guide.tests_organization.fixtures.suite here] for more details.
[endsect] [/section:test_org_boost_test_case_fixture]
[section:test_org_boost_global_fixture `BOOST_GLOBAL_FIXTURE`]
Declares and registers a global fixture. The global fixture is called before any of the test case in the test tree is executed.
The class implementing the fixture should have the appropriate [link boost_test.users_guide.tests_organization.fixtures.model interface].
As any fixture, it is possible to have test assertions in the global fixture.
See [link boost_test.users_guide.tests_organization.fixtures.global here] for more details.
[endsect] [/section:test_org_boost_test_case_fixture]
[endsect] [/reference test organization]