1

I'm using Ganymede on Ubuntu Linux and I have junit-4.3.1.jar in my build path. I click File > New > Java > "JUnit 4 Test Case" when I create a new test, but when it's run, Eclipse appears to be using JUnit 3. I believe this is the case because it's ignoring my annotations.

When I remove all test* methods, JUnit complains "No tests found". If I do the same with another test I already created, JUnit runs fine and finds my test named createTask(). So, it appears to be using JUnit 3 at times, and JUnit 4 at others.

How do I force Eclipse Ganymede to use JUnit 4?

2 Answers 2

2

I figured out the answer via this link:

Spring is apparently incompatible with JUnit 4.3.1 when extending AbstractTransactionalSpringDataSourceTest (or whatever it is). So, I upgraded to JUnit 4.6 (b/c 4.5 has issues) and used the annotation-based configuration, and voila, all is well.

Thank you.

Sign up to request clarification or add additional context in comments.

Comments

0

I have 2 suggestions that might help. First, in the Run/Debug configuration, Make sure the JUnit 4 test runner is selected. Next, if this is a plugin project, add the junit4 runtime to the project as a dependency (in the dependencies tab).

4 Comments

JUnit 4 is test runner that is selected. And this is a standard Java project; builds to a JAR.
How are you launching? Are you creating a run or debug configuration and clicking on it each time, or right-click and run/debug as on the test?
right-click either on the file in Project Explorer or in the editing pane.
Try setting up a debug or run configuration that you can reuse. Use the down arrow by the debug or run buttons and do a new Junit configuration. Then pick JUnit 4. When you want to re-run it, select the configuration from the drop down.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.