I'm playing around this plugin and I wanted to run in terminal a specific test suite by its xml
file.
when I do:
"mvn test -DsuiteXmlFile="test123Suite.xml"
it would always begin running the testng xml
suite. When I switch their order in suiteXMLFiles
, the first xml
will trigger after the command even though i specified the name.
Why is surefire
ignoring the fact that I don't want to run both of these suites and only runs them in order?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<reportsDirectory>target/surefire-reports-${surefire.forkNumber}</reportsDirectory>
<suiteXmlFiles>
<suiteXmlFile>test123Suite.xml</suiteXmlFile>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<parallel>suites</parallel>
<threadCountSuites>2</threadCountSuites>
<perCoreThreadCount>false</perCoreThreadCount>
</configuration>
</plugin>
I have also put fork count to 1 so it doesnt run both of them at the same time, but what it probably does is runs both of them but sequentially.
I just wanted to call:
mvn test -DsuiteXmlFile="test123Suite.xml"
and run only tests inside of that suite.
In order to define the whole set of suite files you need to use property surefire.suiteXmlFiles
, not surefire.suiteXmlFile
.
this will run both
mvn clean test -Dsurefire.suiteXmlFiles="test123Suite.xml,testng.xml"
this will run only one
mvn clean test -Dsurefire.suiteXmlFiles="testng.xml"
mvn clean test -Dsurefire.suiteXmlFiles="test123Suite.xml"
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.