| Priority |
Normal |
| Type | Bug |
| State | Won't fix |
| Assignee | Anna Kozlova |
| Subsystem | Unit Testing. JUnit |
| Affected versions |
No affected versions
|
| Fixed in |
No fix versions
|
| Fixed in build |
Next build |
| Build |
7562
|
| Severity |
0
|
IDEA-16466 |
When a JUnit4 test extends TestCase, individual test methods can't be run |
|
Picture 1.png
(27 KB)
|
package ru.jkff.test;
import junit.framework.TestCase;
import org.junit.Test;
public class SomeTest extends TestCase {
@Test
public void testA() {
System.out.println("testA");
}
@Test
@Ignore("X is bad")
public void testX() {
System.out.println("testX");
}
@Test
public void testB() {
System.out.println("testB");
}
@Test
public void testC() {
System.out.println("testC");
}
}
I was talking about completely incorrect and unobvious behaviour WITH a @Test; according to your words, with @Test annotations my class is _not_ a simple TestCase and should be processed as a JUnit4 test; but it is processed as a mysterious and buggy mixture of JUnit4 and JUnit3, as I pointed in my bug report.
I think that it is an answer for your question.
You can see that 2 command lines (with and without extending TestCase) are the same. Seems that JUnit4 Runner doesn't process correctly mix with JUnit3.
Do you have any suggestions?
Thank you
There are 140 test methods in one test class, the are all annotated with @Test, but the class extends a TestCase too. I can't run a single test method by itself. The IDE allows me to but in reality all 140 tests are executed and reported as being the one test I selected.
(Diana build 8792)
This is especially a problem with extending Spring's JUnit4 abstract test classes and using @Test annotations for methods. In other words you cannot combine the two.