XUnitTestXml

Undocumented in source.

Members

Functions

toString
string toString()

Return the string representation of the test

Variables

result
TestResult result;
uuid
string uuid;

Examples

XUnitTestXml should transform a success test

auto epoch = SysTime.fromUnixTime(0);

TestResult result = new TestResult("Test");
result.begin = Clock.currTime;
result.end = Clock.currTime;
result.status = TestResult.Status.success;

auto allure = XUnitTestXml(result);

allure.toString.strip.should.equal(`<testcase name="Test">` ~ "\n      </testcase>");

XUnitTestXml should transform a failing test

auto epoch = SysTime.fromUnixTime(0);
TestResult result = new TestResult("Test");
result.begin = Clock.currTime;
result.end = Clock.currTime;
result.status = TestResult.Status.failure;
result.throwable = new Exception("message");

auto xunit = XUnitTestXml(result);
xunit.toString.strip.should.equal(`<testcase name="Test">` ~ "\n" ~
`      <failure message="message">` ~ result.throwable.to!string ~ `</failure>` ~ "\n" ~
`      </testcase>`);

Meta