allure steps not included in the report with Cucumber and TestNg
VitalyShalaev opened this issue · 7 comments
Allure steps with annotation "io.qameta.allure.Step" not included in the report with Cucumber and TestNg.
In pom I use dependencies:
If steps looks like that:
@when("Cucumber step")
public void cucumberStep() {
allureStep();
}
@step("This is AllureStep")
public void allureStep() {
allureSubStep();
}
@step("This is SubStep")
public void allureSubStep() {
Allure.step("Allure InnerStep", () ->
Allure.addAttachment("Attachment Name", "Content"));
}
But it should look like this:
You need to configure AspectJ in order to enable @Step
and @Attachment
annotations support. Under the hood, they are actually the same as calling Allure.step
and Allure.addAttachment
APIs.
@baev Could you suggest me how to do this?
I am using the standard setting from the documentation:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.1.0</version> <configuration> <includes> <include>**/RunCucumberTest.java</include> </includes> <systemPropertyVariables> <testFailureIgnore>false</testFailureIgnore> <argLine> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" -Dcucumber.options="--plugin io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm" -Dcucumber.options="--add-plugin io.qase.cucumber5.QaseEventListener" </argLine> </systemPropertyVariables> </configuration> <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> </dependencies> </plugin>
After adding to aop-ajc.xml the report did not change, StepsAspects Pointcuts were missing in the logs.
In the end, I copied the StepsAspects class into my project and it seems to work. Pointcuts appeared in the logs.
After adding to aop-ajc.xml the report did not change, StepsAspects Pointcuts were missing in the logs.
In the end, I copied the StepsAspects class into my project and it seems to work. Pointcuts appeared in the logs.
This happens because the aop-ajc.xml
file is missing from all of the above dependencies. In your case aop-ajc.xml
for TestNG bundled in allure-testng
dependency.
To fix without moving the code and additional files, you need to check that your project contains allure-java-commons
(bundled with allure-cucumber5-jvm
) and allure-testng
.
@a-simeshin
If I use the allure-testng dependency along with allure-cucumber5-jvm, then the tests in the allure report will start to be duplicated.
@VitalyShalaev use this dependency allure-junit4 this will not duplicate but will show the steps. It is working for me fine
@baev when used hybrid framework (TestNG+Cucumber) it does not work I have tried that but when I used Allure-Junit dependency it works and does not duplicate.