Search code examples
scalaintellij-ideaintellij-14scalamock

Why don't specs2 + scalamock tests run in IntelliJ? Multiple suite traits detected


I'm trying to run Specs2 tests from IDEA from both Windows and Mac versions of Intellij IDEA 14. I generated the idea project files using both gen-idea and the built in SBT plugin and get the same results...

When I try to run them, I get

Error running Specs2 in 'scala': Test class not found

I've added packages and switched "search for tests" to in single module but still no avail. I also get the message below on the run config.

Multiple suite traits detected: List(ScTrait: SpecificationStructure, ScTrait: SpecificationStructure,)

The similar post How to run all Specs2 tests under IntelliJ IDEA? doesn't help and it all runs fine from SBT, BTW. I can't run individual tests via the short-cut either :'(

I'm suspecting it's a combination of scalamock and specs2, as if I remove the following from my build.sbt, I can run them again.

"org.scalamock" %% "scalamock-specs2-support" % "3.2" % "test"

Here's the run config.

enter image description here


Solution

  • You should check if you have multiple specs2 jars dependencies in your module. If you just leave one jar dependency the configuration error should disappear.