TestNG surefire,使用Maven命令行运行套件 [英] TestNG surefire, run suite with maven command line

查看:136
本文介绍了TestNG surefire,使用Maven命令行运行套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过maven从命令行运行预定义的xml套件?

Is it possible to run a predefined xml suite from the command line through maven?

我能够进行课程或特定测试.但是我无法运行套件.

I am able to run a class or a particular test. But I am unable to run a suite.

这是我从命令行运行的内容: ->

Here is what I am running from the command line: -->

 mvn -Dtest=TestCircle#mytest -Denvironment=test -Dbrowser=firefox -DscreenShotDirectory=/Users/jeremy/temp test

我确实定义了一个套件,该套件可以通过intelliJ很好地运行,但是我不确定如何调用suite.xml文件.

I do have a suite defined, which runs nicely through intelliJ, but I am not sure how to invoke the suite.xml file.

或者例如,在运行测试之后,testng创建一个testng失败的文件,该文件被设置为再次运行所有失败的测试.

Or for example, after the tests have run, testng creates a testng-failed file which is setup to run all the failed tests again.

使用mvn,我将如何启动该测试套件.

Using mvn, how would I kick off this test suite.

推荐答案

这个答案给了我我想要的东西,即能够在命令行中传递我想要运行的套件的名称:

This answer gave me what I was looking for, namely the ability to pass at the command line the name of the suite I want to run:

简而言之,将以下内容添加到pom.xml的maven-surfire-plugin节中:

In a nutshell, add the following to the maven-surfire-plugin stanza of your pom.xml:

<suiteXmlFiles>
    <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>

然后,您可以在命令行中指定所需的testng套件xml文件:

Then you can specify the desired testng suite xml file at the command line:

mvn clean install test -DsuiteXmlFile=testngSuite.xml

这篇关于TestNG surefire,使用Maven命令行运行套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆