无法使用maven运行多个testng xml文件

无法使用maven运行多个testng xml文件,maven,testng,pom.xml,Maven,Testng,Pom.xml,我的项目有两个testngxml文件,testNG.xml和TestNG2.xml,都在根文件夹中。我对maven pom进行了如下配置,但当我运行时,“TestNG.xml”文件会运行两次,TestNG2.xml保持不变 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin<

我的项目有两个testngxml文件,testNG.xml和TestNG2.xml,都在根文件夹中。我对maven pom进行了如下配置,但当我运行时,“TestNG.xml”文件会运行两次,TestNG2.xml保持不变

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.21.0</version>
            <configuration>
                <suiteXmlFiles>
                    <file>TestNG2.xml</file>
                    <file>TestNG.xml</file>
                </suiteXmlFiles>
                <properties>
                    <property>
                        <name>suitethreadpoolsize</name>
                        <value>2</value>
                    </property>
                </properties>
            </configuration>
        </plugin>

org.apache.maven.plugins
maven surefire插件
2.21.0
TestNG2.xml
TestNG.xml
suitethreadpoolsize
2.
我也尝试过从cmd运行,但还是只运行了两次TestNG.xml

mvn清理测试-Dsurefire.suiteXmlFiles=TestNG2.xml,TestNG.xml


如何在同一次运行中运行这两个文件?

您没有使用正确的标记。您必须在suiteXmlFiles块内重构标记名。pom文件应如下所示:-

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.21.0</version>
    <configuration>
        <suiteXmlFiles>
            <suiteXmlFile>TestNG2.xml</suiteXmlFile>
            <suiteXmlFile>TestNG.xml</suiteXmlFile>
        </suiteXmlFiles>
        <properties>
            <property>
                <name>suitethreadpoolsize</name>
                <value>2</value>
            </property>
        </properties>
    </configuration>
</plugin>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
        <configuration>
            <suiteXmlFiles>
                <suiteXmlFile>${testSuite}.xml</suiteXmlFile>

            </suiteXmlFiles>
            <properties>
                <property>
                    <name>suitethreadpoolsize</name>
                    <value>2</value>
                </property>
            </properties>
        </configuration>
    </plugin>

如何从命令提示符传递多个testNG.xml文件
 mvn clean integration-test -DtestSuite=testNG