0
votes

Well, Maven is too good, when talking about speed. But I want something that is more acceptable. Imagine I wrote a test org.fun.AbcTestCase In such TestCase, I include some JUnit / TestNG tests Now I want to run only this test case, said org.fun.AbcTestCase from command line. How can I do that?

I know it's easy to do it within Eclipse or IDEA. However, I am learning Scala and IDE support is currently terrible, especially when it comes to run unit test.

Here is why I find it difficult: The project would involve many dependencies. When I test my project as a Maven goal, surefire takes care of that. Mimic that with reasonable manual effort is important. The test process need to be fast enough with real time compiler (well, recompile the whole bunch of scala code is a terrible night mare).

2
I know, I'm too much influenced of the Rubish way. But yes, when come this testing, Ruby is just too good. Scala developer is really long for tools that Ruby offer.Phương Nguyễn

2 Answers

3
votes

Use the test parameter in the surefire:test mojo

mvn test -Dtest=MyTest

will run only the test MyTest.class, recompiling only if necessary (if changes are found).

2
votes

If you are free to switch (as I imagine you might be if you have a toy project you're using to learn Scala) you might consider using SBT instead of Maven. Its IDE integration is only rudimentary, but it is quite handy for running tests (it can watch the source tree and re-run tests when you save, or even just the tests that failed during the last run.) Check out the website at http://simple-build-tool.googlecode.com/ .