Struct Attachment

A struct representing an attachment for test steps

struct Attachment ;

Fields

NameTypeDescription
destination stringThe attachement destination. All the attached files will be copied in this folder if it is not allready inside
file stringThe absolute path to the attachment
mime stringThe file mime path
name stringThe attachment name

Methods

NameDescription
fromFile Add a file to the current test or step
fromString Create an attachment from a string
toString

Example

Create an attachement from string

auto a = Attachment.fromString("content");
a.name.should.equal("unknown");
a.mime.should.equal("text/plain");

readText(a.file).should.equal("content");

Example

Convert an attachement to Json string

Attachment("dub", "dub.json", "text/json").toString.should.equal(
  `{"name":"dub","file":"dub.json","mime":"text/json"}`
);