Struct TestCase

A test case that will be executed

struct TestCase ;


this (testCase)
this (suiteName, name, func, labels, location)
this (suiteName, name, func, labels)


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 SourceLocationThe test location
name stringThe test name
suiteName stringThe test case suite name. It can contain . which is treated as a separator for nested suites


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 } }`);