Reputation: 345
I just connected Allure report to my TestNG tests and Maven build. All works fine and reports are supercool. Just one thing - @Step annotation doesn't work. Steps are not appearing in report. I followed the examples.
Upvotes: 6
Views: 16070
Reputation: 499
In my case i was missing below Listener in my testNG.xml
<listeners>
<listener class-name="io.qameta.allure.testng.AllureTestNg"/>
</listeners>
and below pluging and Dependency in my pom.xml
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<reportVersion>2.14.0</reportVersion>
</configuration>
</plugin>
Allure TestNG dependency
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.15.0</version>
</dependency>
please refer to this answer also. Allure results don't generate on Maven build
, it has most of the problems mentioned which are faced in allure maven -testNG Java integration. Also, @steps/@attachments etc will be shown post adding the allureTestNG listener
Upvotes: 0
Reputation: 3303
In order to make @Step, @Parameter and @Attachment annotations work you need to correctly enable AspectJ load-time weaving. Basically this is as simple as passing path to aspectjweaver.jar as -javaagent JVM argument.
Here’s how it can be done in Maven Surefire Plugin: https://github.com/allure-examples/allure-junit-example/blob/master/pom.xml#L63
You must have a aspectjweaver dependency in your pom too (like in the given example), so that this library will be downloaded automatically by Maven. Otherwise the annotations still won't work. Or maybe the tests will not even start, I'm not sure...
To run from the IDE you can specify the same option to the JVM (not the testclass) in the IDE runner window. Replacing the ${settings.localRepository} property with the real path of course. Since that's a maven property and the IDE doesn't know anything about it.
Upvotes: 5
Reputation: 345
SOLVED! I ran the tests via InteliJIDEA testng runner, but should have run via maven only.
You need to run mvn clean test and then mvn site
Upvotes: 3