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.
-
Please make sure you follow Allure FAQ ("XML files created but no steps, attachments or parameters are present...") at https://github.com/allure-framework/allure-core/wiki/FAQ-and-Troubleshooting – volkovs Jan 12 '15 at 08:57
-
SOLVED! I ran the tests via InteliJIDEA testng runner, but should have run via maven only Thanks! – ygrunin Jan 12 '15 at 09:44
-
1You can run tests any way you want but be sure to specify path to aspectjweaver.jar as -javaagent JVM argument if you intend to use annotations on private method calls. – vania-pooh Jan 13 '15 at 07:25
3 Answers
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.

- 3,001
- 1
- 27
- 30
-
-
I am adding the allure as dependency [allure-gradle](https://mvnrepository.com/artifact/io.qameta.allure/allure-gradle/2.5) instead of allure plugin in gradle project .And also added [aspectJweaver](https://mvnrepository.com/artifact/org.aspectj/aspectjweaver/1.6.10) into dependency but still the annotations are not working, any specific reason – uttam Aug 27 '20 at 07:50
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

- 325
- 1
- 4
- 15
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

- 443
- 5
- 14