Scalatest Maven Plugin "no tests were executed"

scalatest-maven-plugin tagstoexclude
maven-surefire-plugin
scala junit maven
scoverage-maven-plugin
scalatest-maven-plugin 2.0 0
scalatest integration test
scalatest maven plugin github
run scalatest

I'm trying to use scalatest and spark-testing-base on Maven for integration testing Spark. The Spark job reads in a CSV file, validates the results, and inserts the data into a database. I'm trying to test the validation by putting in files of known format and seeing if and how they fail. This particular test just makes sure the validation passes. Unfortunately, scalatest can't find my tests.

Relevant pom plugins:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <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}/surefire-reports</reportsDirectory>
                <wildcardSuites>com.cainc.data.etl.schema.proficiency</wildcardSuites>
            </configuration>
            <executions>
                <execution>
                    <id>test</id>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

And here's the test class:

class ProficiencySchemaITest extends FlatSpec with Matchers with SharedSparkContext with BeforeAndAfter {
    private var schemaStrategy: SchemaStrategy = _
    private var dataReader: DataFrameReader = _

    before {
        val sqlContext = new SQLContext(sc)
        import sqlContext._
        import sqlContext.implicits._

        val dataInReader = sqlContext.read.format("com.databricks.spark.csv")
                                            .option("header", "true")
                                            .option("nullValue", "")
        schemaStrategy = SchemaStrategyChooser("dim_state_test_proficiency")
        dataReader = schemaStrategy.applySchema(dataInReader)
    }

    "Proficiency Validation" should "pass with the CSV file proficiency-valid.csv" in {
        val dataIn = dataReader.load("src/test/resources/proficiency-valid.csv")

        val valid: Try[DataFrame] = Try(schemaStrategy.validateCsv(dataIn))
        valid match {
            case Success(v) => ()
            case Failure(e) => fail("Validation failed on what should have been a clean file: ", e)
        }
    }
}

When I run mvn test, it can't find any tests and outputs this message:

[INFO] --- scalatest-maven-plugin:1.0:test (test) @ load-csv-into-db ---
[36mDiscovery starting.[0m
[36mDiscovery completed in 54 milliseconds.[0m
[36mRun starting. Expected test count is: 0[0m
[32mDiscoverySuite:[0m
[36mRun completed in 133 milliseconds.[0m
[36mTotal number of tests run: 0[0m
[36mSuites: completed 1, aborted 0[0m
[36mTests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0[0m
[33mNo tests were executed.[0m

UPDATE By using:

<suites>com.cainc.data.etl.schema.proficiency.ProficiencySchemaITest</suites>

Instead of:

<wildcardSuites>com.cainc.data.etl.schema.proficiency</wildcardSuites>

I can get that one Test to run. Obviously, this is not ideal. It's possible wildcardSuites is broken; I'm going to open a ticket on GitHub and see what happens.


This is probably because there are some space characters in the project path. Remove space in project path and the tests can be discovered successfully. Hope this help.

org.scalatest » scalatest-maven-plugin, Home » org.scalatest » scalatest-maven-plugin. ScalaTest Maven Plugin. Integrates ScalaTest into Maven. License, Apache 2.0. Categories, Maven Plugins. ScalaTest Maven Plugin. Contribute to scalatest/scalatest-maven-plugin development by creating an account on GitHub.


Try excluding junit as a transitive dependency. Works for me. Example below, but note the Scala and Spark versions are specific to my environment.

   <dependency>
        <groupId>com.holdenkarau</groupId>
        <artifactId>spark-testing-base_2.10</artifactId>
        <version>1.5.0_0.6.0</version>
        <scope>test</scope>
        <exclusions>
            <!-- junit is not compatible with scalatest -->
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
        </exclusion>
    </dependency>

org.scalatest » scalatest-maven-plugin » 2.0.0, Building ScalaTest Maven Plugin. Maven 3 is used to manage the build process. To build this plugin, please make sure you have the following installed:- The Git  org.scalatest » scalatest-maven-plugin Apache. Integrates ScalaTest into Maven Last Release on Dec 1, 2017 15. ScalaTest Freespec 2 usages.


With me, it's because I wasn't using the following plugin:

<plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
          <args>
            <arg>-target:jvm-1.8</arg>
          </args>
        </configuration>
      </plugin>

ScalaTest Maven Plugin, ScalaTest Maven Plugin. Contribute to scalatest/scalatest-maven-plugin development by creating an account on GitHub. Home » org.scalatest » scalatest-maven-plugin ScalaTest Maven Plugin. Integrates ScalaTest into Maven License: Apache 2.0:


scalatest-maven-plugin/usage.apt at master · scalatest/scalatest , In my current project we have the following configuration in pom.xml: <plugin> <​groupId>net.alchim31.maven</groupId>  ScalaTest Maven Plugin. Contribute to scalatest/scalatest-maven-plugin development by creating an account on GitHub.


Get ScalaTest to run my tests from Maven, To execute continuous tests using the maven-scalatest-plugin, first make sure that the maven-scalatest-plugin is configured in your pom.xml. Version Scala Scala.js Native Repository Usages Date; 3.3.x. 3.3.0-SNAP2: 2.13 2.12 2.11 2.10: 1 (2.13) 1 (2.12) 1 (2.11) 0.6 (2.13) 0.6 (2.12) 0.6 (2.11) 0.6 (2.10


scala-maven-plugin – scala-maven-plugin, A reporting mojo to capture the ScalaTest output as a file that integrates into the Maven site of a project. Often used code snippets: <plugin> <groupId>org.​scalatest  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.