Attachment
Attachment builder for adding files, screenshots, and logs to test reports.
Public Methods
Section titled “Public Methods”attach
Section titled “attach”Attaches the built attachment to the current test or step.
void attach()fromBinary
Section titled “fromBinary”Creates an attachment from a binary data buffer.
Attachment fromBinary(std::string_view name, std::string_view mimeType, const void* data, size_t size)Parameters:
| Name | Type | Description |
|---|---|---|
name | std::string_view | The name of the attachment. |
mimeType | std::string_view | The MIME type of the attachment (e.g., “image/png”). |
data | const void* | A pointer to the binary data. |
size | size_t | The size of the data in bytes. |
Returns:
An Attachment object.
fromFile
Section titled “fromFile”Creates an attachment from a file.
Attachment fromFile(std::string_view name, std::string_view filePath)Parameters:
| Name | Type | Description |
|---|---|---|
name | std::string_view | The name of the attachment. |
filePath | std::string_view | The path to the file. The MIME type will be detected automatically. |
Returns:
An Attachment object.
fromText
Section titled “fromText”Creates a plain text attachment.
Attachment fromText(std::string_view name, std::string_view content)Parameters:
| Name | Type | Description |
|---|---|---|
name | std::string_view | The name of the attachment. |
content | std::string_view | The text content. |
Returns:
An Attachment object.