1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-04-29 04:03:51 +00:00
Catch2/docs/test-cases-and-sections.md
Phil Nash 4ab680a4fb Expanded docs on tests cases and sections (still work-in-progress)
- also touched up some outdated bits in the tutorial
2013-10-01 08:20:08 +01:00

1.3 KiB

Test cases and sections

While Catch fully supports the traditional, xUnit, style of class-based fixtures containing test case methods this is not the preferred style.

Instead Catch provides a powerful mechanism for nesting test case sections within a test case. For a more detailed discussion see the tutorial.

Test cases and sections are very easy to use in practice:

TEST_CASE( test name [, tags ] ) SECTION( section name )

test name and section name are free form, quoted, strings. The optional tags argument is a quoted string containing one or more tags enclosed in square brackets. Tags are discussed below. Test names must be unique within the Catch executable.

For examples see the Tutorial

Tags

-{placeholder for documentation of tags}-

User Story/ BDD-style test cases

In addition to Catch's take on the classic style of test cases, Catch supports an alternative syntax that allow tests to be written as "executable specifications" (one of the early goals of BDD). This set of macros map on to TEST_CASEs and SECTIONs, with a little internal support to make them smoother to work with.

SCENARIO( scenario name )

-{placeholder for given-when-then docs}-


Home