java.lang.NoSuchMethodException when trying to run Junit 3 suite class
----------------------------------------------------------------------
Key: SUREFIRE-761
URL: https://jira.codehaus.org/browse/SUREFIRE-761
Project: Maven Surefire
Issue Type: Bug
Components: JUnit 3.x support
Affects Versions: 2.9, 2.8
Environment: maven 3.0.3
Reporter: Jan Sievers
Priority: Critical
Attachments: demo.zip
attached small demo project demonstrates that JUnit 3 suite classes can't be
executed due to NoSuchMethodException.
surefire 1.8 and 2.9 are affected. BTW I also tested with older surefire
versions, here the suite class is completely ignored which is also a bug.
We found this bug while porting the tycho surefire plugin to surefire 2.9, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=353222
I will create a patch for this issue.
--- build log snippet ---
[INFO] --- maven-surefire-plugin:2.9:test (default-test) @ demo ---
[INFO] Surefire report directory: C:\ws\tycho\demo\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
org.apache.maven.surefire.util.SurefireReflectionException:
java.lang.reflect.InvocationTargetException; nested exception is
java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
Caused by: org.apache.maven.surefire.util.NestedRuntimeException: When finding
method run; nested exception is java.lang.NoSuchMethodException:
test.demo.Suite.run(junit.framework.TestResult)
at
org.apache.maven.surefire.common.junit3.JUnit3Reflector.getMethod(JUnit3Reflector.java:113)
at
org.apache.maven.surefire.common.junit3.JUnit3Reflector.getRunMethod(JUnit3Reflector.java:208)
at
org.apache.maven.surefire.junit.JUnitTestSet.<init>(JUnitTestSet.java:71)
at
org.apache.maven.surefire.junit.JUnit3Provider.createTestSet(JUnit3Provider.java:103)
at
org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:93)
... 9 more
Caused by: java.lang.NoSuchMethodException:
test.demo.Suite.run(junit.framework.TestResult)
at java.lang.Class.getMethod(Class.java:1605)
at
org.apache.maven.surefire.common.junit3.JUnit3Reflector.getMethod(JUnit3Reflector.java:109)
... 13 more
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira