Tests format

Describes the syntax of the .tests format

Tests files

The tests related to a unit or a namespace reside in a file that has the same name as the namespace but has the extension ".tests". This tests file uses an XML based syntax. Here is an example of a .tests file:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <Suite Name="Suite"> <SetUp>Set up action</SetUp> <Suite Name="Child suite"> <Case Name="Test 1"> <Assert>Assertion 1</Assert> </Case> </Suite> <Case Name="Test 2"> <Assert>Assertion 1</Assert> <Assert>Assertion 2</Assert> </Case> <Case Name="Test 3"> <Assert>Assertion 1</Assert> <Assert>Assertion 2</Assert> </Case> <TearDown>Tear down action</TearDown> </Suite>

Syntax

The main XML elements used in the tests format are:

ElementDescription
<Suite Name="..."> Defines a test suite. A test suite is a grouping of suites and cases. A suite element can contain zero or more <Suite> elements. A suite element can contain zero or more <Case> elements. <Suite> elements should never succeed <Case> elements. A suite element may start with a <SetUp> element and may end with a <TearDown> element.
<Case Name="..."> Defines a test case with one or more <Assert> element. A case element may start with a <SetUp> element and may end with a <TearDown> element.
<Assert>Defines an assertion that must be done for the test to succeed.
<SetUp>Defines actions that have to be performed before executing a test suite or a test case.
<TearDown>Defines actions that have to be performed upon finishing a test suite or a test case.