Test cases have an identifier and are composed of three different parts: the header, the body and an optional cleanup routine, all of which are described in
atf-test-case(4). To define test cases, one can use the
ATF_TEST_CASE(),
ATF_TEST_CASE_WITH_CLEANUP() or the
ATF_TEST_CASE_WITHOUT_HEAD() macros, which take a single parameter specifiying the test case's name.
ATF_TEST_CASE(), requires to define a head and a body for the test case,
ATF_TEST_CASE_WITH_CLEANUP() requires to define a head, a body and a cleanup for the test case and
ATF_TEST_CASE_WITHOUT_HEAD() requires only a body for the test case. It is important to note that these
do not set the test case up for execution when the program is run. In order to do so, a later registration is needed through the
ATF_ADD_TEST_CASE() macro detailed in
Program initialization.
Later on, one must define the three parts of the body by means of three functions. Their headers are given by the
ATF_TEST_CASE_HEAD(),
ATF_TEST_CASE_BODY() and
ATF_TEST_CASE_CLEANUP() macros, all of which take the test case's name. Following each of these, a block of code is expected, surrounded by the opening and closing brackets.