mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 05:45:39 +02:00
Expanded docs on tests cases and sections (still work-in-progress)
- also touched up some outdated bits in the tutorial
This commit is contained in:
30
docs/test-cases-and-sections.md
Normal file
30
docs/test-cases-and-sections.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Test cases and sections
|
||||
|
||||
While Catch fully supports the traditional, *x*Unit, 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](tutorial.md#testCasesAndSections).
|
||||
|
||||
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](tutorial.md)
|
||||
|
||||
## 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](../README.md)
|
Reference in New Issue
Block a user