based on Does Maven Surefire execute test cases sequentially by default?, I know that the surefire execute test cases sequentially, in other words, One by One.
I want to know which test cases executed first and which next, Through output information of surefire, I find that the order maybe random, for example:
- test
boyTest.java
subdir
- girlTest.java
- parentTest.java the test directory has three test case: and the testcase execute order is girlTest.java, parentTest.java,boyTest.java
and So I want to make sure that whether the order that testCase executed is
random
To verify that the ordering surefire used is the one you expect, run your build with debug enabled (
-xflag). E.g. in my case I see the following:By default order is not random but defined through how the file system returns the list of the tests (
filesystemin surefire terms).There are other available orderings which you can choose through
surefire.runOrderproperty (one of which israndom).For more information see Surefire plugin runOrder