Question

I am using the Typesafe Scala IDE 3.0.0 together with the TestNG 6.8.1 plugin. What I really miss is the possibility to right-click on a Scala file, then select "Run As" and "TestNG Test" to launch the tests in the IDE. This feature works for Java-based TestNG tests, but not for tests written in Scala.

Silly example:

import org.testng.annotations.Test
import org.testng.Assert

class MyTest {
  @Test
  def doSomeTesting() {
    Assert.assertEquals(true, false)
  }
}

I am also using Maven and the Surefire plugin, and the test is picked up and executed nicely when I run "mvn test". So I assume the Eclipse plugin does not recognize that the Scala file is a TestNG test. Is there a way to make the TestNG plugin work with Scala tests? Any working configuration could help.

Was it helpful?

Solution

I had the same problem you described. Instead of the Run menu, you should use the related shortcut. That is to say ⌘ + ⌥ + X then N for Mac users, Ctrl + Alt + X then N for the others.

Hope that helps.

OTHER TIPS

Support for TestNG could (and should) be provided in a separate plug-in. I noticed there is already an Eclipse plug-in for TestNG, did you try to install it and see if it works?

Provided your Scala packages are in the right location (the package declaration matches the physical location of a source file), it should work fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top