是否可以通过 maven 从命令行运行预定义的 xml 套件?
我能够进行类(class)或特定测试。但我无法运行套件。
这是我从命令行运行的: -->
mvn -Dtest=TestCircle#mytest -Denvironment=test -Dbrowser=firefox -DscreenShotDirectory=/Users/jeremy/temp test
我确实定义了一个套件,它可以很好地通过 intelliJ 运行,但我不确定如何调用 suite.xml 文件。
或者例如,在测试运行之后,testng 创建一个 testng-failed 文件,该文件被设置为再次运行所有失败的测试。
使用 mvn,我将如何启动这个测试套件。
最佳答案
这个答案给了我一直在寻找的东西,即能够在命令行传递我要运行的套件的名称:
http://www.vazzolla.com/2013/03/how-to-select-which-testng-suites-to-run-in-maven-surefire-plugin/
简而言之,将以下内容添加到 pom.xml 的 maven-surfire-plugin 节中:
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
然后你可以在命令行指定想要的testng suite xml文件:
mvn clean install test -DsuiteXmlFile=testngSuite.xml
关于testing - TestNG surefire,使用 maven 命令行运行套件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10391312/