| Summary: | Cannot run individual JUnit tests when importing Maven projects which uses JUnit < 4.6 | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Nicholas Wright <cs94njw> |
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> |
| Status: | RESOLVED NOT_ECLIPSE | QA Contact: | |
| Severity: | critical | ||
| Priority: | P3 | CC: | cs94njw, daniel_megert, jarthana, moritz.eysholdt |
| Version: | 4.5 | ||
| Target Milestone: | 4.6 M3 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Nicholas Wright
I've suggested this isn't an improvement, as this always worked in the past. And the user is led down this path by the GUI too. Changed importance to critical. I have a JUnit failure in my code. I suspect the problem is that one JUnit is affecting subsequent JUnits. But because I can't run them individually in Eclipse, I can't identify which JUnit is failing because of a bug, and which is failing because of previous state. Moritz, you added the SubForestFilter in bug 443498. Could you have look? Nicholas, the stacktraces for the org.junit.* methods don't match any recent version of JUnit. Could it be that your test project has been set up to run with org.junit 4.4 or 4.5? Maybe it's already enough to update your dependencies to require org.junit 4.12. You're right. Upgrading to JUnit 4.9 made it start working in Eclipse. Thanks! Glad to hear you can continue testing. For the records: The problem is a breaking change in JUnit between 4.4 and 4.5. In 4.4, there was a method org.junit.runner.manipulation.Filter#apply(Runner), but in 4.5, the signature was changed to Filter#apply(Object). It would be pretty hard to make this work with all versions of JUnit. In 4.5, SubForestFilter fails because it uses an API that has only been added in 4.6: java.lang.NoSuchMethodError: org.junit.runner.Description.getClassName()Ljava/lang/String; at org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher$LeadingIdentifierMatcher.matches(DescriptionMatcher.java:95) at org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher$CompositeMatcher.matches(DescriptionMatcher.java:38) at org.eclipse.jdt.internal.junit4.runner.SubForestFilter.collectIncludedDescriptions(SubForestFilter.java:49) at org.eclipse.jdt.internal.junit4.runner.SubForestFilter.apply(SubForestFilter.java:41) at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:670) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Starting from 4.6, everything is fine. |