【发布时间】:2014-01-02 22:42:37
【问题描述】:
我想使用 maven 命令从命令行运行特定的测试套件。我正在使用 TestNg 框架。
我的 pom 有以下配置设置:
<profiles>
<profile>
<id>selenium-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<!--
<parallel>methods</parallel>
<threadCount>6</threadCount>
-->
<!-- <suiteXmlFiles>
<suiteXmlFile>src/test/java/com/kanban/testng/factory.xml</suiteXmlFile>
</suiteXmlFiles> -->
<suiteXmlFiles>
<suiteXmlFile>${suiteFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
在我正在运行的命令行上:
mvn clean test -DsuiteFile=src/test/java/com/kanban/testng/factory.xml
理想情况下,这应该只运行 factory.xml 测试套件,但它会运行项目中的所有测试。
如果我遗漏了什么,任何人都可以提出建议。
【问题讨论】:
-
为了安全起见 - 将 factory.xml 复制到您的当前目录并以
mvn clean test -DsuiteFile=factory.xml运行命令。也请在此处发布 factory.xml 文件的内容。