【问题标题】:How to pass multiple suiteXML files from command line如何从命令行传递多个suiteXML文件
【发布时间】:2013-03-23 00:36:05
【问题描述】:

我需要从命令行运行多个 XML 套件文件。

我的 POM.xml -

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.5</version>
    <configuration>
        <suiteXmlFiles>
                <suiteXmlFile>src/test/resources/xml_Suites/${tests}.xml</suiteXmlFile>
        </suiteXmlFiles>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>

从命令行尝试这个 -

mvn clean -Dtests={abcd,xyz} test

只有 xyz.xml 被触发,而 abcd.xml 没有被触发。

基本上只有大括号中提到的最后一个 xml 文件被触发。

上面的语法有什么问题吗?

【问题讨论】:

    标签: maven testng pom.xml


    【解决方案1】:

    我认为您需要指定使用整个路径 更改-Dtests=src/test/resources/xml_Suites/abcd.xml,src/test/resources/xml_Suites/xyz.xml

    【讨论】:

    • 但路径已经在 中可用 - src/test/resources/xml_Suites/${tests}.xml
    • 只需将 ${tests} 保留在 标记中并删除其余部分。对于多个文件,它不会扩展到 src/test/resources/xml_Suites/abc.xmlsrc/test/resources/xml_Suites/xyz.xml 对于单个文件,它会工作的。
    • 谢谢@niharika。更改后工作。我基本上从 XML 中删除了路径并从 CLI 传递了完整路径。
    【解决方案2】:

    以下示例对我有用:

    mvn test -Dsurefire.suiteXmlFiles=/Users/mdafsarali/repository/path/IOS.xml,/Users/mdafsarali/repository/path/IOS2.xml,/Users/mdafsarali/repository/path/IOS3.xml
    

    【讨论】:

      猜你喜欢
      • 2011-09-28
      • 1970-01-01
      • 2021-05-15
      • 1970-01-01
      • 1970-01-01
      • 2015-08-13
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多