You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marvin Froeder (JIRA)" <ji...@codehaus.org> on 2010/08/25 20:09:32 UTC
[jira] Commented: (SUREFIRE-642) TestNG support doesn't w/o Junit
on classpath
[ http://jira.codehaus.org/browse/SUREFIRE-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=233126#action_233126 ]
Marvin Froeder commented on SUREFIRE-642:
-----------------------------------------
I made a small patch for it, I hope a 2.6.1 could carry this fix.
{code}
Index: src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
===================================================================
--- src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (revision 989255)
+++ src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (working copy)
@@ -29,13 +29,6 @@
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.surefire.report.ReportEntry;
-import org.apache.maven.surefire.report.ReporterException;
-import org.apache.maven.surefire.report.ReporterManager;
-import org.apache.maven.surefire.report.ReporterManagerFactory;
-import org.apache.maven.surefire.suite.AbstractDirectoryTestSuite;
-import org.apache.maven.surefire.testset.SurefireTestSet;
-import org.apache.maven.surefire.testset.TestSetFailedException;
/**
* Test suite for TestNG based on a directory of Java test classes. Can also execute JUnit tests.
@@ -115,13 +108,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 );
{code}
> TestNG support doesn't w/o Junit on classpath
> ---------------------------------------------
>
> Key: SUREFIRE-642
> URL: http://jira.codehaus.org/browse/SUREFIRE-642
> Project: Maven Surefire
> Issue Type: Bug
> Components: TestNG support
> Affects Versions: 2.6
> Reporter: Marvin Froeder
>
> 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.
--
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