我正在运行我的自动化测试脚本(这是一个Maven项目 基于Java并在AzureDevops CI / CD管道中使用测试ng)。我已将所有代码推送到Github,并创建了一个Maven任务来运行测试。
但是当我尝试运行Maven任务时,它没有考虑testng.xml,在那里我拥有所有测试配置(例如要运行哪些测试(测试的顺序))以及其他配置(如侦听器)来创建一些自定义内容报告。它只是运行我完整的Maven项目中存在的所有测试类。
请帮助我在构建中添加哪个配置/任务,以便基于testng.xml运行测试
下面是Pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd“>
4.0.0
测试自动化
测试
0.0.1-快照
罐
测试
http://maven.apache.org
org.seleniumhq.selenium
硒java
3.14.0
org.testng
ng
6.11
编译
org.apache.poi
poi
3.16-beta2
com.relevantcodes
范围报告
2.41.2
公地
公地
2.6
log4j
log4j
1.2.17
com.googlecode.json-简单
json-简单
1.1.1
<!-- for gson https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>listener</name>
<value>com.qa.ExtentReportListner.ExtentRerportListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>