我的 pom.xml 中有以下条目,其中包含配置中定义的套件文件。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
使用 Maven 在 cmd 中运行它的正确方法是什么?我可以使用下面的命令运行测试,但是当它已经在 pom 中定义时,在命令中再次指示 testng.xml 是没有意义的。
mvn clean test -DsuiteXmlFile=testng.xml
原文由 jeffsia 发布,翻译遵循 CC BY-SA 4.0 许可协议
最简单的解决方案是,在 surefire 插件中添加以下行。
并按如下方式运行您的 xml 文件,