I have the following unit tests:
import org.scalatest.FunSpec
import org.scalatest.Matchers._
class MyClassSpec extends FunSpec {
describe("MyClass"){
describe("Scenario 1"){
it("Condition 1") {
true shouldEqual false
}
it("Condition 2"){
true shouldEqual false
}
}
}
}
When I run maven test, this compiles fine but the tests are not found. Here is the output:
[INFO] --- maven-surefire-plugin:2.7:test (default-test) @ project-name ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ project-name ---
Discovery starting.
Discovery completed in 202 milliseconds.
Run starting. Expected test count is: 0
DiscoverySuite:
Run completed in 236 milliseconds.
Total number of tests run: 0
Suites: completed 1, aborted 0
Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
No tests were executed.
As the output shows, I'm using the scalatest plugin for maven. Here is the relevant section of my pom.xml:
<!-- disable surefire -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- enable scalatest -->
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory>
<junitxml>junit</junitxml>
<filereports>report.txt</filereports>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
I'm pretty new to getting this stuff set up, so I'm not sure if there is some other thing I'm not checking. I get the exact same results if I run maven clean and then maven test. I'm using ScalaTest version 3.0.1. I have another project with tests running successfully also using 3.0.1 (I've copied everything I can find between the two projects that seems even remotely related).