allure-java
allure-java copied to clipboard
to pass Description, name information to test results labels for fixtures
Is your feature request related to a problem? Please describe.
Currently, fixtures (methods marked with @Before
and @After
annotations) in Cucumber JVM tests don't have support to add a human-readable name to be shown in the Allure Report. Now, those methods are shown as follows, which is not user friendly at all:
Describe the solution you'd like
An optimal solution would be to be able to put an annotation @Step
on the fixture method. For example:
@Step("Attach scenario logs")
@After
public void attachLogs() {}
And then show the value of the @Step
annotation in the report instead of the package and method name as it is now.
@baev @cheshi-mantu it's been nearly 1.5y since this feature request was made. Any updates or plans you could share?
Hook names are provided as strings by cucumber. We cannot access the method via reflection (or in some other way) to extract annotations.
I suggest you create a feature request for the cucumber itself. We'll be happy to support whatever solution they suggest.
However, you can change the hook names via the Allure Lifecycle API:
@Before("@hooks")
public void before() {
Allure.getLifecycle().updateFixture(hook -> hook.setName("Human readable before name"));
// do something
}
PS make sure to use the latest available version (2.26.0)