History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-13891
Type: Bug Bug
Status: Open Open
Assignee: Alexey Kudravtsev
Reporter: Serge Baranov
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Rerun Failed Tests Where Tests are in an Abstract Class

Created: 26 Jul 07 22:39   Updated: 08 Aug 07 19:38
Component/s: Unit Testing. JUnit

Environment: Mac

Build: 6,180
Severity: Medium


 Description  « Hide
Support feedback:

If you have an abstract test class that provides some generic tests which is extended for concrete usage and one of the tests defined
in the abstract test class fails then the Rerun Failed Tests because it is trying to instantiate the abstract test class rather than the
sub class.

java.lang.RuntimeException: Cannot instantiate test(s): java.lang.NoSuchMethodException: com.xxx.xxx.junit.AbstractBeanTestCase.<init>()
at com.intellij.rt.execution.junit.TestRunnerUtil$FailedTestCase.runTest(TestRunnerUtil.java:213)
at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:65)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
Caused by: java.lang.NoSuchMethodException: com.xxx.xxx.junit.AbstractBeanTestCase.<init>()
at java.lang.Class.getConstructor0(Class.java:1937)
at java.lang.Class.getConstructor(Class.java:1027)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:23)
... 2 more



 All   Comments   Work Log   Change History      Sort Order:
Mike Hanafey - 08 Aug 07 17:37
I have a similar problem in build 6873 (Selena M1b). My test cases all extend a base class but it does not make any difference if the base class is abstract or not. If a test fails and I click on the rerun failed button, the following exception if produced (using junit-4.4):

/opt/jdk1.6.0_01/bin/java -Dfile.encoding=US-ASCII -classpath /export/a/mkh/idea-out/Trak/test/Trak:/export/a/mkh/idea-out/Trak/production/Trak:/opt/jars/spring-framework-2.0.5/dist/spring.jar:/opt/jars/spring-framework-2.0.5/dist/spring-mock.jar:/opt/jars/spring-framework-2.0.5/dist/spring-aspects.jar:/opt/jars/commons-logging-1.1/commons-logging-1.1.jar:/opt/jars/commons-lang-2.3/commons-lang-2.3.jar:/apps/jars/commons-collections-3.2/commons-collections-3.2.jar:/apps/JARS/jConnect60a.jar:/opt/jars/junit4.4/junit-4.4.jar:/opt/jdk1.6.0_01/jre/lib/jce.jar:/opt/jdk1.6.0_01/jre/lib/plugin.jar:/opt/jdk1.6.0_01/jre/lib/management-agent.jar:/opt/jdk1.6.0_01/jre/lib/resources.jar:/opt/jdk1.6.0_01/jre/lib/javaws.jar:/opt/jdk1.6.0_01/jre/lib/deploy.jar:/opt/jdk1.6.0_01/jre/lib/rt.jar:/opt/jdk1.6.0_01/jre/lib/jsse.jar:/opt/jdk1.6.0_01/jre/lib/charsets.jar:/opt/jdk1.6.0_01/jre/lib/ext/sunjce_provider.jar:/opt/jdk1.6.0_01/jre/lib/ext/sunpkcs11.jar:/opt/jdk1.6.0_01/jre/lib/ext/dnsns.jar:/opt/jdk1.6.0_01/jre/lib/ext/localedata.jar:/opt/idea/idea-7M1b/lib/idea_rt.jar com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 @/var/tmp/idea_junit25207.tmp
1 test class found in package 'genomix.trak'
Exception in thread "main" java.lang.NoSuchMethodError: org.junit.internal.runners.MethodValidator.<init>(Ljava/ang/lass;)V
at com.intellij.rt.junit4.Junit4TestMethodAdapter.run(Junit4TestMethodAdapter.java:38)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:65)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)

Process finished with exit code 1


Mike Hanafey - 08 Aug 07 19:38
This same exception happens if you try to run a test on a single method. In other words, if you do a Ctrl+Shift+F10 inside an @Test method the exception happens, but Ctrl+Shift+F10 outside of any method works.