Reputation: 553
I googled about this question. The results I found suggested that I need to run a maven/ant build to generate the xml.
My project is an Maven & TestNG project. But while debugging we use the option 'Run as TestNG Suite' in eclipse.
I have added the following code to my testng.xml.
<listeners>
<listener class-name="ru.yandex.qatools.allure.testng.AllureTestListener" />
</listeners>
This generates the UUID-testsuite.xml in project\target\site\allure-maven-plugin\data directory, but the report just contains the suite title and no other data is displayed.
I understand that in order to make @Step and @Attachment annotations work we need to correctly enable AspectJ in configuration. I am not sure how to do this in testng.xml file.
Please let me know, if I am missing something here.
Upvotes: 2
Views: 1837
Reputation: 4666
Assuming, you have @Step and @Attachment methods are define in your test code, you just need to add aspectjweaver dependency in pom.xml file. Refer this Allure github wiki page
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
<!--only for 1.3.* TestNG adapters. Since 1.4.0.RC4, the listener adds via ServiceLoader-->
<properties>
<property>
<name>listener</name>
<value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
maven-surefire-plugin will invoke testng with listener
<properties>
<property>
<name>listener</name>
<value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
</property>
</properties>
And pass aspectj settings as jvm argument:
- javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
Also you can refer to this example project for more clarity.
Upvotes: 2