【发布时间】:2020-12-23 11:07:37
【问题描述】:
我正在使用 Surefire 插件运行 TestNG 套件,我需要运行来自 suite.xml 的完整套件或特定测试。同样,我使用testnames 属性提供测试名称,它与testnames 一起工作正常
但是当我在没有testnames 参数的情况下运行时,它会抛出异常The test(s) <[]> cannot be found.
我想知道有什么可以让它成为可选的吗?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>testnames</name>
<value>${testnames}</value>
</property>
</properties>
<useSystemClassLoader>false</useSystemClassLoader>
<testFailureIgnore>false</testFailureIgnore>
</configuration>
</plugin>
<plugin>
我正在使用的 Maven 命令:
mvn test -DcfgFile=abc.cfg -DsuiteXmlFile=Suite.xml -Dtestnames=test1 -f pom.xml -U
我希望它也能正常工作:
mvn test -DcfgFile=abc.cfg -DsuiteXmlFile=Suite.xml -f pom.xml -U
提前致谢。
【问题讨论】: