Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过命令行使用Maven运行特定的TestNG套件_Maven_Selenium_Testng - Fatal编程技术网

通过命令行使用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

我试图使用命令行在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>

<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