[
http://jira.codehaus.org/browse/SUREFIRE-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_121005
]
argast edited comment on SUREFIRE-377 at 1/23/08 7:58 AM:
-----------------------------------------------------------
The fix does not work if tests are written using junit 4.4
Perhaps with additional check it would work:
...
if (junit.framework.Test.class.isAssignableFrom( c ) || isJunit4(c)) {
junitTestClasses.add( c );
} else {
testNgTestClasses.add( c );
}
...
public boolean isJunit4(Class c) {
Class<? extends Annotation> testAnnotation = null;
try {
testAnnotation = (Class<? extends Annotation>)
Class.forName("org.junit.Test");
} catch (ClassNotFoundException e) {
return false;
}
Method[] methods = c.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].isAnnotationPresent(testAnnotation)) {
return true;
}
}
return false;
}
was (Author: argast):
The fix does not work if tests are written using junit 4.4
> When JUnit and TestNG tests are in same project, only one set gets run
> ----------------------------------------------------------------------
>
> Key: SUREFIRE-377
> URL: http://jira.codehaus.org/browse/SUREFIRE-377
> Project: Maven Surefire
> Issue Type: Bug
> Components: TestNG support
> Affects Versions: 2.4
> Reporter: Dan Fabulich
> Fix For: 2.4
>
> Attachments: surefire377.patch, testng-junit-together.zip
>
>
> The attached Maven project has two tests: one JUnit test and one TestNG test.
> According to the documentation, in this case TestNG should run both tests.
> Run "mvn test". Only the TestNG test will run. If you modify the pom to set
> the property "junit=true", only the JUnit test will run.
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.4-SNAPSHOT</version>
> <configuration>
> <properties>
> <property>
> <name>junit</name>
> <value>true</value>
> </property>
> </properties>
> </plugin>
--
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