winglam opened a new pull request #348: URL: https://github.com/apache/maven-surefire/pull/348
The changes in this pull request enable Surefire to run test classes and test methods in any order specified by a newly added [\<runOrder\>](http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#runOrder) (testorder). Namely, the changes include - A new [\<runOrder\>](http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#runOrder) called testorder that would make Surefire run test classes and test methods in the order specified by [\<test\>](http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#test). Regex and include/exclude are supported as is the case for other runOrders - Tests to TestListResolverTest and RunOrderCalculatorTest for the newly added features The newly added testorder [\<runOrder\>](http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#runOrder) is supported for all JUnit 3 and JUnit 4 tests. I will plan on supporting JUnit 5 tests after these changes are accepted. **Simple (no regex) example using [Dubbo](https://github.com/apache/dubbo.git):** ``` mvn test -Dsurefire.runOrder=testorder \ -Dtest=org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest#testSticky2,\ org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest#testSticky1,\ org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest#testSticky3,\ org.apache.dubbo.rpc.protocol.dubbo.DubboProtocolTest#testNonSerializedParameter\ -pl dubbo-rpc/dubbo-rpc-dubbo ``` Output from Maven should say that the test class `DubboLazyConnectTest` ran before `DubboProtocolTest` The file `DubboLazyConnectTest.xml` (`dubbo-rpc/dubbo-rpc-dubbo/target/surefire-reports/TEST-org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest.xml`) should say ``` <testcase name="testSticky2"...> <testcase name="testSticky1"...> <testcase name="testSticky3...> ``` **Regex example using [Dubbo](https://github.com/apache/dubbo.git):** ``` mvn test -Dsurefire.runOrder=testorder \ -Dtest=org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest*,\ org.apache.dubbo.rpc.protocol.dubbo.DubboProtocolTest#testDubboProtocol*\ -pl dubbo-rpc/dubbo-rpc-dubbo ``` Output from Maven should say ``` Tests run: 4 … in org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest Tests run: 3 … in org.apache.dubbo.rpc.protocol.dubbo.DubboProtocolTest ``` The file `DubboProtocolTest.xml` (`dubbo-rpc/dubbo-rpc-dubbo/target/surefire-reports/TEST-org.apache.dubbo.rpc.protocol.dubbo.DubboProtocolTest.xml`) should say ``` <testcase name=”testDubboProtocol”...> <testcase name="testDubboProtocolWithMina"...> <testcase name="testDubboProtocolMultiService”...> ``` **Include/Exclude example using [Dubbo](https://github.com/apache/dubbo.git):** ``` mvn test -Dsurefire.runOrder=testorder \ -Dtest=org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest#test*,\ !org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest#testSticky2\ -pl dubbo-rpc/dubbo-rpc-dubbo ``` Output from Maven should say `Tests run: 3 … in org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest` The file `DubboLazyConnectTest.xml` (`dubbo-rpc/dubbo-rpc-dubbo/target/surefire-reports/TEST-org.apache.dubbo.rpc.protocol.dubbo.DubboLazyConnectTest.xml`) should say ``` <testcase name="testSticky1"...> <testcase name="testSticky3"...> <testcase name="testSticky4...> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org