[ 
http://jira.codehaus.org/browse/SUREFIRE-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_120450
 ] 

Daniel Beland commented on SUREFIRE-321:
----------------------------------------


I had a look at the code and it seems pretty easy to do:


in the class org.apache.maven.surefire.suite.AbstractDirectoryTestSuite, method 
public void execute( ReporterManager reporterManager, ClassLoader classLoader 
), we can order the tests before we execute them: 

List keySet = new ArrayList(testSets.keySet());
Collections.sort(keySet);
for ( Iterator i = keySet.iterator(); i.hasNext(); ) 
{
   SurefireTestSet testSet = (SurefireTestSet) testSets.get(i.next());
   executeTestSet( testSet, reporterManager, classLoader );
}


Now for the forked processes (always), it needs to be changed in the class 
org.apache.maven.surefire.booter.SurefireBooter, method private int 
runSuitesForkPerTestSet():

List keySet = new ArrayList(testSets.keySet());
Collections.sort(keySet);
for ( Iterator j = keySet.iterator(); j.hasNext(); ) { ... }


It works fine with junit3, I did not test with junit4 and testng but from what 
I understood it should work fine too. And I am a bit lost on how to test it 
properly (unit or integration test) so sorry I cannot include a proper test 
with it.


> Run tests in alphabetical order
> -------------------------------
>
>                 Key: SUREFIRE-321
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-321
>             Project: Maven Surefire
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Daniel Beland
>            Priority: Minor
>             Fix For: 2.x
>
>
> It would be nice if the tests were run in alphabetical order (with complete 
> package name).
> So all tests in a package run in order and same things for each packages.
> It just makes it easier to know where we currently are in the tests and makes 
> it easier to estimate how long it will take before the tests finish to run.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to