-
Notifications
You must be signed in to change notification settings - Fork 3
Allure Attachments
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.
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.
....
private final AllureLifecycle allureLifecycle;
public SomeService(AllureLifecycle allureLifecycle) {
this.allureLifecycle = allureLifecycle;
}
....
....
public void testMe() {
allureLifecycle.addAttachment("attachment name", "text/plain", ".txt", "content".getBytes());
}
....