Return the string representation of the step
AllureStepXml should transform a step
auto epoch = SysTime.fromUnixTime(0); StepResult result = new StepResult(); result.name = "step"; result.begin = Clock.currTime; result.end = Clock.currTime; auto allure = AllureStepXml("allure", result, 0, ""); allure.toString.should.equal( ` <step start="` ~ (result.begin - epoch).total!"msecs".to!string ~ `" stop="` ~ (result.end - epoch).total!"msecs".to!string ~ `" status="passed"> <name>step</name> </step>`);
AllureStepXml should transform nested steps
auto epoch = SysTime.fromUnixTime(0); StepResult result = new StepResult(); result.name = "step"; result.begin = Clock.currTime; result.end = Clock.currTime; StepResult step = new StepResult(); step.name = "some step"; step.begin = result.begin; step.end = result.end; result.steps = [ step, step ]; auto allure = AllureStepXml("allure", result, 0, ""); allure.toString.should.equal( ` <step start="` ~ (result.begin - epoch).total!"msecs".to!string ~ `" stop="` ~ (result.end - epoch).total!"msecs".to!string ~ `" status="passed"> <name>step</name> <steps> <step start="` ~ (result.begin - epoch).total!"msecs".to!string ~ `" stop="` ~ (result.end - epoch).total!"msecs".to!string ~ `" status="passed"> <name>some step</name> </step> <step start="` ~ (result.begin - epoch).total!"msecs".to!string ~ `" stop="` ~ (result.end - epoch).total!"msecs".to!string ~ `" status="passed"> <name>some step</name> </step> </steps> </step>`);
AllureStepXml should add the attachments
string resource = buildPath(getcwd(), "some_image.png"); scope(exit) { resource.remove(); } std.file.write(resource, ""); auto uuid = randomUUID.toString; scope(exit) { rmdirRecurse("allure"); } auto epoch = SysTime.fromUnixTime(0); StepResult result = new StepResult(); result.name = "step"; result.begin = Clock.currTime; result.end = Clock.currTime; result.attachments = [ Attachment("name", resource, "image/png") ]; auto allure = AllureStepXml("allure", result, 0, uuid); allure.toString.should.equal( ` <step start="` ~ (result.begin - epoch).total!"msecs".to!string ~ `" stop="` ~ (result.end - epoch).total!"msecs".to!string ~ `" status="passed"> <name>step</name> <attachments> <attachment title="name" source="` ~ uuid ~ `/name.0.some_image.png" type="image/png" /> </attachments> </step>`);