我正在尝试为我们的集成测试设置allure2,但有些事情进展不顺利。
TestNG监听器工作正常,因为正在填充allure-results文件夹。像@Step和@Attachment这样的注释不起作用。
来自https://github.com/allure-examples/allure-testng-example的示例存在同样的问题。
pom.xml的重要部分:
<dependencies> <dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.6</version>
</dependency>
<dependencies>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<argLine>
-
javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<groups>${groups}</groups>
<excludedGroups>${excludedGroups}</excludedGroups>
<properties>
<property>
<name>listener</name>
<value>
net.sprd.qa.webdriver.listener.ScreenshotListener,net.sprd.qa.common.listeners.TestPrinterListener,net.sprd.qa.cyo.listeners.Transformer,net.sprd.qa.common.listeners.JiraListener,net.sprd.qa.webdriver.listener.SlackListener,
</value>
</property>
<property>
<name>configfailurepolicy</name>
<value>continue</value>
</property>
<property>
<name>dataproviderthreadcount</name>
<value>${dataProviderthreadCount}</value>
</property>
</properties>
<systemPropertiesFile>
${propertiesFile}
</systemPropertiesFile>
<disableXmlReport>false</disableXmlReport>
<reportsDirectory>target/surefire-reports</reportsDirectory>
<parallel>methods</parallel>
<threadCount>${threadCount}</threadCount>
<forkCount>0</forkCount>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.8</version>
<configuration>
<resultsDirectory>../allure-results</resultsDirectory>
</configuration>
</plugin>
</plugins>
jvm参数正确传递,路径实际指向我的aspectjweaver jar。
问题:
答案 0 :(得分:2)
问题是argLine
为0时未应用forkCount
。
如果你真的需要禁用分叉,有两种方法可以解决这个问题:
MAVEN_OPTS
中配置AspectJ Weaver。在这种情况下,所有maven代码都将被编织,因此您可能需要添加额外的aop.xml
并指定需要编织的类/包。