Skip to content

Allure Attachments

vvolverine edited this page Nov 1, 2018 · 1 revision

Allure architecture

Main flow manager in Allure report framework is AllureLifecycle. This class contains a lot of configuration methods, that can be treated as "internal" - usually this methods invoked by allure report plugins for specific test framework realization. To hide this implementation and simplify the life for clients Allure were introduced. This is a static container that responsible to create singleton instance of AllureLifecycle and then operate with it. By default Allure able to create very simple lifecycle without configurable options.

Sprimber approach

Since Sprimber already has a bean of AllureLifecycle and the scope of this bean by default singleton there is no needs to have additional wrapper for it. Also end client can override default AllureLifecycleconfiguration in there own container configuration with any additional features. By this more elegant way not to use Allure.addAttachment(...) methods as it suggested by Allure documentation, but use lifecycle object directly with methods addAttachment. For future plans some convenient features from Allure wrapper can be added to the Sprimber Allure extension.

Examples

Autowire lifecycle

....
private final AllureLifecycle allureLifecycle;

public SomeService(AllureLifecycle allureLifecycle) {
    this.allureLifecycle = allureLifecycle;
}
....

Add text attachment

....
public void testMe() {
    allureLifecycle.addAttachment("attachment name",  "text/plain", ".txt", "content".getBytes());
}
....
Clone this wiki locally