Skip to main content

Test Case

Each test document contains zero or more test cases. Each test case should document and prove a single thing about the code under test (e.g. a single command line of the tested CLI). Test cases are the smallest unit of testing. They can fail or pass independently of each other. They are executed in the order they appear in the test document.

Anatomy

Independent of the format (Markdown, Cram) that a test case is written, it consists of the following components:

ComponentRequiredDescription
TitleNoAn optional title for the test case, so that a human can understand what the test case is intended to prove.
CommentNoAn optional comment leaving space for more description
Shell ExpressionYesThe subject of the test ("that what is being tested").
Output ExpectationsNoAny amount of assertions of the output that the shell expression will print
Exit CodeNoThe expected exit code that the shell expression must end in.
ConfigurationNoDetailed, per-test-case configuration.

Format

Find more about the formatting of test cases in: