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?

Elliot
  • 1,286
  • 2
  • 12
  • 22

2 Answers2

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.

Community
  • 1
  • 1
Elliot
  • 1,286
  • 2
  • 12
  • 22
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).

AdamC
  • 16,087
  • 8
  • 51
  • 67
  • JUnit 4 is test runner that is selected. And this is a standard Java project; builds to a JAR. – Elliot Jun 08 '09 at 16:37
  • 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? – AdamC Jun 08 '09 at 17:35
  • right-click either on the file in Project Explorer or in the editing pane. – Elliot Jun 08 '09 at 18:36
  • 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. – AdamC Jun 08 '09 at 19:47