AllureAttachmentXml

Allure representation of an atachment. It will copy the file to the allure folder with an unique name

Constructors

this
this()
Undocumented in source.
this
this(string destination, Attachment attachment, size_t indent, string uuid)

Init the struct and copy the atachment to the allure folder

Members

Functions

toString
string toString()

convert the attachment to string

Examples

Allure attachments should be copied to a folder containing the suite name

string resource = buildPath(getcwd(), "some_image.png");
std.file.write(resource, "");

auto uuid = randomUUID.toString;
auto expectedPath = buildPath(getcwd(), "allure",  uuid, "name.0.some_image.png");

scope(exit) {
  rmdirRecurse("allure");
}

auto a = AllureAttachmentXml("allure", Attachment("name", resource, ""), 0, uuid);

expectedPath.exists.should.equal(true);

Allure attachments should avoid name collisions

string resource = buildPath(getcwd(), "some_image.png");
std.file.write(resource, "");

auto uuid = randomUUID.toString;

buildPath(getcwd(), "allure",  uuid).mkdirRecurse;
auto expectedPath = buildPath(getcwd(), "allure", uuid, "name.1.some_image.png");
auto existingPath = buildPath(getcwd(), "allure", uuid, "name.0.some_image.png");
std.file.write(existingPath, "");

scope(exit) {
  rmdirRecurse("allure");
}

auto a = AllureAttachmentXml("allure", Attachment("name", resource, ""), 0, uuid);

expectedPath.exists.should.equal(true);

Meta