Struct Attachment
A struct representing an attachment for test steps
struct Attachment
;
Fields
Name | Type | Description |
---|---|---|
destination
|
string | The attachement destination. All the attached files will be copied in this folder if it is not allready inside |
file
|
string | The absolute path to the attachment |
mime
|
string | The file mime path |
name
|
string | The attachment name |
Methods
Name | Description |
---|---|
fromFile
(name, path, mime)
|
Add a file to the current test or step |
fromString
(content)
|
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"}`
);