繁体   English   中英

Maven surefire 插件无法选择正确的 testng suite.xml 文件

[英]Maven surefire plugin fails to pick correct testng suite.xml file

我的 pom.xml 中有以下设置:-

    <groupId>co.uk.me-test.project</groupId>
<artifactId>my-test-project
<version>1.0-SNAPSHOT</version>

<properties>
    <sl4j.version>1.7.7</sl4j.version>
    <suiteFile>src/test/resources/testproject/testng_suiteone.xml</suiteFile>
    <suiteFile>src/test/resources/testproject/testng_suitetwo.xml</suiteFile>
    <suiteFile>src/test/resources/testproject/testng_suitethree.xml</suiteFile>
    <suiteFile>src/test/resources/testproject/testng_suitefour.xml</suiteFile>
    <suiteFile>src/test/resources/testproject/testng_suitefive.xml</suiteFile>
    <suiteFile>src/test/resources/testproject/testng_suitesix.xml</suiteFile>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.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>2.19.1</version>
            <configuration>
                <!--<testFailureIgnore>true</testFailureIgnore>-->
                <suiteXmlFiles>
                    <suiteXmlFile>${suiteFile}</suiteXmlFile>
                </suiteXmlFiles>
                <properties>
                    <property>
                        <name>parallel</name>
                        <value>methods</value>
                    </property>
                    <property>
                        <name>threadCount</name>
                        <value>1</value>
                    </property>
                    <property>
                        <name>dataproviderthreadcount</name>
                        <value>1</value>
                    </property>
                </properties>
            </configuration>
        </plugin>
    </plugins>
</build>

在运行时,我正在调用具有以下目标的测试:-

mvn clean install -DsuiteXmlFile=testng_suitethree.xml

我有一个相同(看似)的项目,它根据作为目标传入的套件名称选择正确的suite.xml 文件。 那么,为什么这个项目总是选择suitesix.xml,不管我是否传入另一个? 如果我注释掉除了我想要的所有套件文件,那么它会运行它。 我该如何解决这个问题?

<properties>
    <suiteFile>{suiteFile}</suiteFile>
</properties>

MVN干净的测试-D surefire.suiteXmlFiles =的testng.xml> out.log

这将起作用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM