JUnit support

Hi folks,

Do you have JUnit support on the Scala plugin roadmap? That is, to be able to run JUnit tests written in Scala directly from IDE. At the moment we have a separate Java module for tests because of this. It would be nice to simplify the project structure by moving those to Scala eventually.

Note, users of other test tools would benefit from this feature too if they provide @RunWith compatible JUnit runner.

Cheers, Joni

0
9 comments
Avatar
Permanently deleted user

junit4 is not acala compatible in general (no nesting annotations in scala), but running junit3 should be pretty easy

0
Avatar
Permanently deleted user

I see. But it would still be useful. For instance specs BDD tool provides a JUnit4 compatible runner:

http://code.google.com/p/specs/source/browse/trunk/src/main/scala/org/specs/runner/JUnitSuiteRunner.scala

and so does JDave:

http://svn.laughingpanda.org/svn/jdave/trunk/jdave-junit4/src/java/jdave/junit4/JDaveRunner.java

This is a common way to benefit from existing JUnit tools without using JUnit API itself.

Cheers, Joni

0

Some JUnit support provided now. Also as TestNG support.

0

Some JUnit support provided now. Also as TestNG support.

]]>

0
Avatar
Permanently deleted user

I can't figure out how to get JUnit support to work with Scala. I'm using the latest version of the plugin as of this date. I'm actually using Specs with the JUnit4 runner. I create a JUnit run configuration but on running it complains that "No tests found in package ...". I'm not sure what to do. I have classes named  ...Test.

0

Did you try something like this


import junit.framework.TestSuite
import org.junit.Test

class Goo {
  @Test
  def testgoo() {
    assert(2 == 3)
  }
}





 

?

0
Avatar
Permanently deleted user

That definitely does not work.

HOWEVER, a java file in my scala project totally works:


package test.scala.com.twitter.service.cachet.test.unit;

import junit.framework.TestSuite;
import org.junit.Test;

public class Goop {
    @Test
    public void testgoo() {
      assert(2 == 3);
    }

}



0
Avatar
Permanently deleted user

Actually the Java code causes a test class to be found but not a test method. so no tests run but the test runner comes up and goes green.

if you have git installed, `git clone git://github.com/nkallen/cachet.git`

That's my code with all of the IntelliJ files too.

You can see the behavior. the scala test isn't found and the java one doesn't have individual tests.

If you figure out how to get that to work, what I really want to work is `CacheEntrySpecTest`.

0
Avatar
Permanently deleted user

Nick,

This is not bug, but feature, which is not implemented yet. You're able to run your JUnit4-testclass by Ctra-Alt-F10 on class directly but you cannot do it for the whole package, cause we haven't implemented appropriate indices yet. We're doing our bet to implement them for next release.

With best regards,
Ilya

0

Please sign in to leave a comment.