OtherTestSuite

Undocumented in source.

Members

Functions

aCustomTest
void aCustomTest()
Undocumented in source. Be warned that the author may not have intended to support it.
afterAll
void afterAll()
Undocumented in source. Be warned that the author may not have intended to support it.
afterEach
void afterEach()
Undocumented in source. Be warned that the author may not have intended to support it.
beforeAll
void beforeAll()
Undocumented in source. Be warned that the author may not have intended to support it.
beforeEach
void beforeEach()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

order
string[] order;
Undocumented in source.

Examples

TestClassDiscovery should find the Test Suite class

auto discovery = new TestClassDiscovery();
discovery.addModule!(`lifecycle/trial/discovery/testclass.d`, `trial.discovery.testclass`);

auto testCases = discovery.getTestCases;

testCases.length.should.equal(2);
testCases[0].suiteName.should.equal(`trial.discovery.testclass.SomeTestSuite`);
testCases[0].name.should.equal(`A simple test`);

testCases[1].suiteName.should.equal(`trial.discovery.testclass.OtherTestSuite`);
testCases[1].name.should.equal(`Some other name`);

discoverTestCases should find the Test Suite class

auto testDiscovery = new TestClassDiscovery;

auto testCases = testDiscovery.discoverTestCases(__FILE__);

testCases.length.should.equal(2);
testCases[0].suiteName.should.equal(`trial.discovery.testclass.SomeTestSuite`);
testCases[0].name.should.equal(`A simple test`);

testCases[1].suiteName.should.equal(`trial.discovery.testclass.OtherTestSuite`);
testCases[1].name.should.equal(`Some other name`);

TestClassDiscovery should execute tests from a Test Suite class

scope (exit)
{
  SomeTestSuite.lastTest = "";
}

auto discovery = new TestClassDiscovery();
discovery.addModule!(`lifecycle/trial/discovery/testclass.d`, `trial.discovery.testclass`);

auto test = discovery.getTestCases.filter!(a => a.suiteName == `trial.discovery.testclass.SomeTestSuite`)
  .filter!(a => a.name == `A simple test`).front;

test.func();

SomeTestSuite.lastTest.should.equal("a simple test");

TestClassDiscovery should execute the before and after methods tests from a Test Suite class

scope (exit)
{
  OtherTestSuite.order = [];
}

auto discovery = new TestClassDiscovery();
discovery.addModule!(`lifecycle/trial/discovery/testclass.d`, `trial.discovery.testclass`);

auto test = discovery.getTestCases.filter!(a => a.suiteName == `trial.discovery.testclass.OtherTestSuite`)
  .filter!(a => a.name == `Some other name`).front;

test.func();

OtherTestSuite.order.should.equal(["before all", "before each",
    "a custom test", "after each", "after all"]);

Meta