-
Notifications
You must be signed in to change notification settings - Fork 167
Attachments
An attachment in Java code is simply a method annotated with @Attachment returns either String or byte array which should be added to report:
@Attachment
public String performedActions(ActionSequence actionSequence) {
return actionSequence.toString();
}
@Attachment(value = "Page screenshot", type = "image/png")
public byte[] saveScreenshot(byte[] screenShot) {
return screenShot;
}
In order to economize free disk space you can remove attachments if corresponding test case passed. This is done allure.report.remove.attachments
system property. Simply set this property somewhere in tests code to PCRE regular expression and Allure will remove any attachment which name matches this regular expression. For example if your test saves a lot of PNG screenshots and you don't want to store them for passed cases - set system property allure.report.remove.attachments=.*\.png
. To apply this setting globally you can put file named allure.properties
in your classpath. See AllureConfig for existing properties list.
Attachment name supports the same placeholders like steps do.
- aShot - WebDriver Screenshot utility. Take screenshots, crop, prettify, compare.
- HTML Elements - A Java framework that provides easy-to-use interaction with page elements in webpage tests.
- Properties - A Java library for populating beans with system environment properties in a simple and convenient way.
- Perspective - API and shell to orchestrate multiple clouds.