Class junit.extensions.ExceptionTestCase has no public constructor TestCase(String name) or TestCase()
I'm using #2206. I created a new project with a source & test root.
Then I created a test case.
When I select the root of the tests & execute "Run All Tests" my test
runs but, for reasons I don't understand, I also get:
!ExceptionTestCase (junit.extensions)
!warning (junit.framework.TestSuite$1)
junit.framework.AssertionFailedError: Class junit.extensions.ExceptionTestCase has no public constructor TestCase(String name) or TestCase()
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
>
Can anyone tell me where this is coming from & how to stop it? It is
causing my tests to fail.
Regards,
Matt
请先登录再写评论。
It looks to me like they are running all the tests in the classpath, not only those that are in your test source tree. Don't know if this is a bug or a feature :). I know that I don't like it, because I have a one library with tests atteched to it, and it runs all those tests as well.
Here's how I got rid of the problem in this particular case:
- decompiled ExceptionTestCase
- made it abstract
- complied it
- put it back in junit.jar
I just found where you can set where to look for the tests. Check "Run/Debug Configurations" --> JUnit --> "Edit Defaults". I made default to "In single module" and it looked for tests only in my test sources. No more failures in tests other than your own.
Thats not much good if you have a multi-module project though.
Did you log a tracker entry for this?
Nick
http://www.intellij.net/tracker/idea/viewSCR?publicId=36483