Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.6
-
Fix Version/s: 2.7
-
Component/s: TestNG support
-
Labels:None
-
Complexity:Intermediate
-
Number of attachments :
Description
I have the same problem that Larry reported here:
http://jira.codehaus.org/browse/SUREFIRE-615?focusedCommentId=232600&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_232600
Our company excludes junit from classpath to make sure people won't use it by mistake.
Issue Links
- is related to
-
SUREFIRE-615
Surefire providers shouldn't need to download old versions of the library
-
I made a small patch for it, I hope a 2.6.1 could carry this fix.
Index: surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java =================================================================== --- surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (revision 989255) +++ surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (working copy) @@ -115,13 +115,24 @@ throw new IllegalStateException( "You must call locateTestSets before calling execute" ); } + Class junitTest; + try + { + junitTest = Class.forName( "junit.framework.Test" ); + } + catch ( ClassNotFoundException e ) + { + junitTest = null; + } + List testNgTestClasses = new ArrayList(); List junitTestClasses = new ArrayList(); for ( Iterator it = testSets.values().iterator(); it.hasNext(); ) { SurefireTestSet testSet = (SurefireTestSet) it.next(); Class c = testSet.getTestClass(); - if (junit.framework.Test.class.isAssignableFrom( c )) { + if ( junitTest != null && junitTest.isAssignableFrom( c ) ) + { junitTestClasses.add( c ); } else { testNgTestClasses.add( c ); Index: surefire-integration-tests/src/test/resources/testng-simple/pom.xml =================================================================== --- surefire-integration-tests/src/test/resources/testng-simple/pom.xml (revision 989255) +++ surefire-integration-tests/src/test/resources/testng-simple/pom.xml (working copy) @@ -39,6 +39,12 @@ <version>${testNgVersion}</version> <classifier>jdk15</classifier> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies>I tamper with testng-simple so it can catch the issue