Skip to content

Add global attachments and errors API#74

Merged
delatrie merged 13 commits into
mainfrom
globals
Apr 29, 2026
Merged

Add global attachments and errors API#74
delatrie merged 13 commits into
mainfrom
globals

Conversation

@delatrie
Copy link
Copy Markdown
Contributor

Context

Allure Report 3.2.0 has introduced global attachments and errors: report-wide information that is not tied to a particular test.

This PR extends the Allure API to allow producing global errors and attachments at runtime.

API changes

1. New Allure::globalAttachment function:

Examples:

Allure::globalAttachment("text", "Lorem Ipsum");
Allure::globalAttachment("config", '{ "name": "my-project" }', "application/json");
Allure::globalAttachment("response", $responseText, "text/markdown", ".md");

2. New Allure::globalAttachmentFile function:

Examples:

Allure::globalAttachmentFile("machine-log", "./logs/trace.log");
Allure::globalAttachmentFile("machine list", "./machine-list.json, "application/json");
Allure::globalAttachmentFile("README", "./README.md, "text/markdown", ".md");

3. New Allure::globalError function:

Examples:

try
{
    // ...
}
catch (Throwable $e)
{
    Allure::globalError($e);
}
Allure::globalError("A critical error has occured. The test process will be terminated");
Allure::globalError(
    message: "A critical error has occured. The test process will be terminated",
    trace: "Exception: teardown failed\n    at \MyOrg\Demo\Teardown",
);

Checklist

@delatrie delatrie merged commit 30bfd2a into main Apr 29, 2026
22 checks passed
@delatrie delatrie deleted the globals branch April 29, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants