Struct TestCase
A test case that will be executed
struct TestCase
;
Constructors
Name | Description |
---|---|
this
(testCase)
|
|
this
(suiteName, name, func, labels, location)
|
|
this
(suiteName, name, func, labels)
|
Fields
Name | Type | Description |
---|---|---|
func
|
void delegate() | The function that must be executed to check if the test passes or not. In case of failure, an exception is thrown. |
labels
|
Label[] | A list of labels that will be added to the final report |
location
|
SourceLocation | The test location |
name
|
string | The test name |
suiteName
|
string | The test case suite name. It can contain which is treated as a
separator for nested suites
|
Example
TestCase string representation should be a JSON string
void MockTest() {}
auto testCase = TestCase("some suite", "some name", &MockTest, [ Label("label1", "value1"), Label("label2", "value2") ]);
testCase .location = SourceLocation("file.d", 42);
testCase .toString .should .equal(`{ "suiteName": "some suite", "name": "some name", ` ~
`"labels": [ { "name": "label1", "value": "value1" }, { "name": "label2", "value": "value2" } ], ` ~
`"location": { "fileName": "file.d", "line": 42 } }`);