Reputation: 31526
I wrote some very basic tests in specs2.
import org.scalatest._
import org.specs2.mutable._
class MySpec extends Specification {
"Arithmetic" should {
"add" in {
"two numbers " in {
1 + 1 mustEqual (2)
}
"three numbers" in {
1 + 1 + 1 mustEqual (3)
}
"compare numbers" in {
2 must be lessThanOrEqualTo(1)
}
}
}
}
And when I run them it seems they are running as expected as you can see below
You can see that 2 tests are successful and 1 test has failed. good.
But I don't understand why is Specs2 saying "No tests were executed" in yellow. What's going on?
Upvotes: 1
Views: 2942
Reputation: 74619
tl;dr Remove one test dependency in libraryDependencies
in the build and fix imports in MySpec
.
The reason for the message is that libraryDependencies
in the project uses both specs2 and ScalaTest libraries that may look as follows:
libraryDependencies += "org.specs2" %% "specs2-core" % "3.6.2" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.5" % "test"
Otherwise, you'd have gotten compilation error for the MySpec
specification as it imports org.scalatest._
and import org.specs2.mutable._
:
import org.scalatest._
import org.specs2.mutable._
Upvotes: 2
Reputation: 11498
Two tests were ran, one MySpec
and the other ScalaTest
. The ScalaTest
was the one that had No tests were executed
.
The output there has three sections: 1. results for MySpec
, 2. results for ScalaTest
, and 3. results for all (summary).
Upvotes: 4