WestCoastProjects
WestCoastProjects

Reputation: 63201

Some ScalaTest suites are not being executed

Given a class following the ScalaTest signature:

class GEMTests extends FunSuite with Matchers with BeforeAndAfterAll {

And inside of it we have some enabled tests like this:

test("GEMFullPostal") {
   // logic, logic, ..
}

Why would a certain Test Suite not be executed? Other test suites are being run correctly.

When I run the test suite through Intellij it does run that given test - which promptly fails due to an incorrect sql statement. But both

  mvn test

and the Jenkins CI/CD build allows the entire application to pass scalatest . I can see in the output no mention of that particular class.

So .. intellij recognizes the class as a ScalaTest but it is being skipped by maven command line (including jenkins). What might be "special" about this test suite? Note it is in the same directory as other Test Suites that are being run automatically.

Upvotes: 0

Views: 133

Answers (1)

WestCoastProjects
WestCoastProjects

Reputation: 63201

Found the issue: inside the pom.xml there is a filtering mechanism happening for the scalatest plugin

        <plugin>
            <groupId>org.scalatest</groupId>
            <executions>
                <execution>
                    <id>test</id>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <suffixes>(?&lt;!Integration)(Test|Spec)</suffixes>
                    </configuration>
                </execution>

So the fix is to add the Tests extensions to that filter:

<suffixes>(?&lt;!Integration)(Test|Tests|Spec)</suffixes>

Upvotes: 0

Related Questions