开发者

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:

  • Eclipse for Java Developers, 3.5.1
  • Scala 2.7.7
  • JUnit 4.7

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 e开发者_运维知识库nd 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!


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 ;-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜