通过命令行使用Maven运行特定的TestNG套件
我试图使用命令行在Maven中运行特定的TestNG套件 我有两套不同的套房通过命令行使用Maven运行特定的TestNG套件,maven,selenium,testng,Maven,Selenium,Testng,我试图使用命令行在Maven中运行特定的TestNG套件 我有两套不同的套房 smoke.xml regression.xml 我的pom.xml文件如下所示 <groupId>com.FNB</groupId> <artifactId>FNB_Testing</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging&g
smoke.xml
regression.xml
我的pom.xml
文件如下所示
<groupId>com.FNB</groupId>
<artifactId>FNB_Testing</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>FNB_Testing</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
com.FNB
FNB_测试
0.0.1-快照
罐子
FNB_测试
http://maven.apache.org
UTF-8
org.seleniumhq.selenium
硒爪哇
3.4.0
org.testng
testng
6.11
测试
org.apache.maven.plugins
maven surefire插件
2.20
/FNB_测试/回归.xml
/FNB_测试/smoke.xml
我正在使用命令mvn test-DsuiteXmlFile=*套件名称*
但是,即使使用了somke.xml,它也只会运行回归套件您可以像下面这样参数化多个套件文件
<suiteXmlFiles>
<!-- Pass testng.xml files as argument from command line -->
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
你觉得下面的答案有用吗?它解决了您的问题吗?*
-Dsurefire.suiteXmlFile=regression.xml,smoke.xml
<suiteXmlFiles>
<!-- Pass testng.xml files as argument from command line -->
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
mvn clean test -Dsurefire.suiteXmlFiles=regression.xml,smoke.xml