summaryrefslogtreecommitdiffstats
path: root/Help/prop_test/FIXTURES_SETUP.rst
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2016-09-07 04:04:07 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-20 18:37:38 (GMT)
commit73f47c9e46d42513cd7eeb08e27c4d1a424949ad (patch)
treef7f275e022e3c6debf4450015d1ae40e46fb56a3 /Help/prop_test/FIXTURES_SETUP.rst
parent6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b (diff)
downloadCMake-73f47c9e46d42513cd7eeb08e27c4d1a424949ad.zip
CMake-73f47c9e46d42513cd7eeb08e27c4d1a424949ad.tar.gz
CMake-73f47c9e46d42513cd7eeb08e27c4d1a424949ad.tar.bz2
CTest: Add support for test fixtures
Add new test properties: * FIXTURES_SETUP * FIXTURES_CLEANUP * FIXTURES_REQUIRED to specify the roles and dependencies of tests providing/using test fixtures.
Diffstat (limited to 'Help/prop_test/FIXTURES_SETUP.rst')
-rw-r--r--Help/prop_test/FIXTURES_SETUP.rst47
1 files changed, 47 insertions, 0 deletions
diff --git a/Help/prop_test/FIXTURES_SETUP.rst b/Help/prop_test/FIXTURES_SETUP.rst
new file mode 100644
index 0000000..a220215
--- /dev/null
+++ b/Help/prop_test/FIXTURES_SETUP.rst
@@ -0,0 +1,47 @@
+FIXTURES_SETUP
+--------------
+
+Specifies a list of fixtures for which the test is to be treated as a setup
+test.
+
+Fixture setup tests are ordinary tests with all of the usual test
+functionality. Setting the ``FIXTURES_SETUP`` property for a test has two
+primary effects:
+
+- CTest will ensure the test executes before any other test which lists the
+ fixture(s) in its :prop_test:`FIXTURES_REQUIRED` property.
+
+- If CTest is asked to run only a subset of tests (e.g. using regular
+ expressions or the ``--rerun-failed`` option) and the setup test is not in
+ the set of tests to run, it will automatically be added if any tests in the
+ set require any fixture listed in ``FIXTURES_SETUP``.
+
+A setup test can have multiple fixtures listed in its ``FIXTURES_SETUP``
+property. It will execute only once for the whole CTest run, not once for each
+fixture. A fixture can also have more than one setup test defined. If there are
+multiple setup tests for a fixture, projects can control their order with the
+usual :prop_test:`DEPENDS` test property if necessary.
+
+A setup test is allowed to require other fixtures, but not any fixture listed
+in its ``FIXTURES_SETUP`` property. For example:
+
+.. code-block:: cmake
+
+ # Ok: dependent fixture is different to setup
+ set_tests_properties(setupFoo PROPERTIES
+ FIXTURES_SETUP Foo
+ FIXTURES_REQUIRED Bar
+ )
+
+ # Error: cannot require same fixture as setup
+ set_tests_properties(setupFoo PROPERTIES
+ FIXTURES_SETUP Foo
+ FIXTURES_REQUIRED Foo
+ )
+
+If any of a fixture's setup tests fail, none of the tests listing that fixture
+in its :prop_test:`FIXTURES_REQUIRED` property will be run. Cleanup tests will,
+however, still be executed.
+
+See :prop_test:`FIXTURES_REQUIRED` for a more complete discussion of how to use
+test fixtures.