Posted By

Tagged

Running scalatest tests in Eclipse

One is supposed to be able to run JUnit tests in Eclipse by right clicking the test class and select, from context menu, Run As | JUnit Test. However, if a scalatest is added without the @RunWith(classOf[JUnitRunner]), the Eclipse context menu item Run As | JUnit Test is not available. The only menu item under Run As is Run Configurations ....

Adding the @RunWith(classOf[JUnitRunner]) triggers Eclipse to add two menu item, JUnit Test, and Scala JUnit Test to be added under Run As on the context menu. Removing the annotation, will only trigger Eclipse to remove the JUnit Test item, with the Scala JUnit Test item remained. It looks like a bug. (It is about Scala IDE 3.0.1)