[
https://jira.codehaus.org/browse/SUREFIRE-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=356475#comment-356475
]
Sergey Malahovsky commented on SUREFIRE-1119:
---------------------------------------------
@Tibor
I've investigated this issue and found that main reason is in maven-shared /
org.apache.maven.shared.utils.io.DirectoryScanner / scandir method.
DirectoryScanner returns list of files to include in alphabetical order.
So it needs to update
org.apache.maven.surefire.util.DefaultDirectoryScanner.collectTests() in
surefire-api:
{code}
import org.apache.commons.lang3.ArrayUtils;
String[] collectTests()
{
String[] tests = EMPTY_STRING_ARRAY;
if ( basedir.exists() )
{
org.apache.maven.shared.utils.io.DirectoryScanner scanner =
new org.apache.maven.shared.utils.io.DirectoryScanner();
scanner.setBasedir( basedir );
String[] processIncludes = new String[0];
if ( includes != null ) {
processIncludes = processIncludesExcludes(includes);
}
if ( excludes != null ) {
scanner.setExcludes( processIncludesExcludes( excludes ) );
}
for(int inc = 0; inc < processIncludes.length; inc++){
scanner.setIncludes( processIncludes[inc] );
scanner.scan();
String[] includedFiles = scanner.getIncludedFiles();
tests = ArrayUtils.addAll(tests, includedFiles);
}
for ( int i = 0; i < tests.length; i++ ) {
String test = tests[i];
test = test.substring( 0, test.indexOf( "." ) );
tests[i] = test.replace( FS.charAt( 0 ), '.' );
}
}
return tests;
}
{code}
and org.apache.maven.plugin.surefire.util.DirectoryScanner.scan() in
maven-surefire-common:
{code}
import org.apache.commons.lang3.ArrayUtils;
public DefaultScanResult scan() {
String[] specific = specificTests == null ? new String[0] :
processIncludesExcludes( specificTests );
SpecificFileFilter specificTestFilter = new SpecificFileFilter(
specific );
List<String> result = new ArrayList<String>();
if ( basedir.exists() )
{
String[] tests = new String[0];
String[] processIncludes = new String[0];
org.apache.maven.shared.utils.io.DirectoryScanner scanner =
new org.apache.maven.shared.utils.io.DirectoryScanner();
scanner.setBasedir( basedir );
if ( includes != null ) {
processIncludes = processIncludesExcludes(includes);
}
if ( excludes != null ) {
scanner.setExcludes( processIncludesExcludes( excludes ) );
}
for(int inc = 0; inc < processIncludes.length; inc++){
scanner.setIncludes( processIncludes[inc] );
scanner.scan();
String[] includedFiles = scanner.getIncludedFiles();
tests = ArrayUtils.addAll(tests, includedFiles);
}
for ( String test : tests )
{
if ( specificTestFilter.accept(
convertSlashToSystemFileSeparator(
stripBaseDir( basedir.getAbsolutePath(), test ) )
) )
{
result.add( convertToJavaClassName( test ) );
}
}
}
return new DefaultScanResult( result );
}
{code}
After this I hope we will can to implement this wish.
> Run tests without order
> -----------------------
>
> Key: SUREFIRE-1119
> URL: https://jira.codehaus.org/browse/SUREFIRE-1119
> Project: Maven Surefire
> Issue Type: Wish
> Affects Versions: 2.18
> Reporter: Sergey Malahovsky
> Priority: Minor
>
> It will be great to have ability to run tests in direct order without any
> sorting.
> For example:
> <configuration>
> <includes>
> <include>**/*CTestSuite*</include>
> <include>**/*ATestSuite*</include>
> <include>**/*BTestSuite*</include>
> </includes>
> <runOrder>direct</runOrder>
> </configuration>
> In current solution test suites will be sorted by alphabetical (or another
> order): **/*ATestSuite*, **/*BTestSuite*, **/*CTestSuite*.
> But sometimes it needs to run without any sorting in order as specified in
> <includes>/<include> tags: **/*CTestSuite*, **/*ATestSuite*, **/*BTestSuite*.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)