In order to run all Maven tests, we can use:
mvn clean test
If we want to run specific test class, we can use:
mvn clean test -Dtest=className
If we want to run specific method from specific test class, we can use:
mvn clean test -Dtest=className#methodName
But I want to run:
src\\test\\java
)src\\test\\java
)Are there Maven commands using which I can achieve above two?
If using surefire plugin then you may use the below options.
For multiple classes you can use,
mvn -Dtest=TestSquare,TestCi*le test
For multiple methods in same class you can use,
mvn -Dtest=TestCircle#testOne+testTwo test
Refer docs
You can use wildcards - note that you have to quote the test argument so the shell does not expand the wildcard.
mvn -Dtest="TestSquare,TestCi*le" test
(using maven-surefire-plugin:2.17)
如果您想从子目录启动所有测试类,例如:/doc/ 您可以使用命令:
mvn -Dtest=*/doc/* test
You can add multiple classes in TestNG with their groups, like
<groups>
<run>
<include name = "checkintest" />
<include name = "videoSpider" />
<include name = "xmlTCUploader" />
<include name = "PALLogin" />
</run>
</groups>
<classes>
<class name="SeleniumUC"/>
<class name="PALTestCasesSuite"/>
</classes>
After this, you can use these group with Maven like -
mvn -Dgroups=PALLogin test
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.