Skip to content
teigen edited this page Sep 13, 2010 · 5 revisions

scalatest-junit4runner is a JUnit4 Runner for ScalaTest

It lets you run ScalaTests from both Maven and your JUnit4 enabled IDE by annotating your tests as shown in the example below

Install


git clone git://github.com/teigen/scalatest-junit4runner.git
cd scalatest-junit4runner
mvn clean install

Add as a dependency



com.jteigen.scalatest
junit4runner
1.0-SNAPSHOT
test

Use


import com.jteigen.scalatest.JUnit4Runner
import org.junit.runner.RunWith
import org.scalatest.matchers.ShouldMatchers
import org.scalatest.Spec

@RunWith(classOf[JUnit4Runner])
class SimpleTest extends Spec with ShouldMatchers {
describe(“Demo”){
it(“should run”){
1 + 1 should be (2)
}

ignore(“should ignore”){ 1 + 1 should be (3) // doesn’t fail as the test is ignored } it(“should crash and burn!”){ 1 + 1 should be (3) } }

}

Clone this wiki locally