waterlooalex
waterlooalex

Reputation: 13892

Is there a problem-free way to run Scala 2.7.7 unit tests in Eclipse integrated nicely?

I'm developing Scala code using Eclipse, often when I run tests I get this error:

No tests found with test runner 'JUnit 3'.

Environment:

I'm currently writing my tests as JUnit3 tests, and invoking them by right clicking on a package in the project explorer, choosing Run As -> JUnit Test. (I was writing them as JUnit4 tests but ran into even more problems.)

If I fire up eclipse, the tests may not run unless I first open the source code file for the test. If I do open the source code file for the test, it will run. However, often then when I make any modification to the test file or any other source code file, Eclipse will refuse to run my tests, saying: "No tests found with test runner 'JUnit 3'."

I just repeated this just now:

  1. Open eclipse
  2. Open the .scala file with some tests
  3. Invoke the tests by right clicking on the package for that file in the project explorer and choosing Run As -> JUnit Test
  4. It ran the tests
  5. One failed
  6. I changed a string literal in the failing test to fix it
  7. I then re-launced the test using the same method, and I get the dreaded "No tests found with test runner 'JUnit 3'."
  8. I get this same method using other methods of launching the tests, e.g. JUnit buttons or menus to re-run all or some tests

To get the tests to run again I close and re-open Eclipse... So I end up relaunching Eclipse many many times a day.

Note: I do often use XML literals in my tests, I wonder if that has anything to do with it.

2nd Note: See my answer to this thread: What is the current state of the Scala Eclipse plugin? where I described some of the other problems I'm having with Scala+Eclipse. Most of the problems are just minor annoyances, but this test invocation problem is a real time waster, would love to find a way around it!

Upvotes: 3

Views: 415

Answers (1)

Miles Sabin
Miles Sabin

Reputation: 23046

This Just works on trunk ... JUnit 3 and 4 unit test are detected and Run As => JUnit test does the right thing.

Oh, and BTW, the best way to get my attention on this sort of thing is to file a bug or enhancement ticket in Trac rather than posting messages to StackOverflow (even though it worked this time ;-)

Upvotes: 3

Related Questions