/ Published in: Scala
This is a minimum scalatest suite that we can run inside 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)
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)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package scalaunittest @RunWith(classOf[JUnitRunner]) // Run As | JUnit Test test("list length") { assert(ls.length == 3) } }