Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven won't run scala tests

Tags:

maven

scala

I'm using maven scala test plugin as described here. I defined two test classes and put them under src/test/scala:

enter image description here

Tests are looking like the following:

class LoginTest extends FlatSpec with ShouldMatchers with WebBrowser with Eventually with IntegrationPatience {
    ...
}

My pom.xml contains the following dependencies / configuration:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.44.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest_2.11</artifactId>
        <version>2.2.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <skipTests>true</skipTests>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest-maven-plugin</artifactId>
            <version>1.0</version>
            <configuration>
                <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                <junitxml>.</junitxml>
                <filereports>WDF TestSuite.txt</filereports>
            </configuration>
            <executions>
                <execution>
                    <id>test</id>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <version>2.15.2</version>
            <executions>
                <execution>
                    <id>scala-compile</id>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

When I run mvn test I got the message:

[INFO] --- scalatest-maven-plugin:1.0:test (test) @ selenium ---
Discovery starting.
Discovery completed in 30 milliseconds.
Run starting. Expected test count is: 0
DiscoverySuite:
Run completed in 91 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.

Calling tests from Intellij brings a message:

0 test class found in package '<default package>'
like image 470
Konstantin Milyutin Avatar asked Nov 01 '22 10:11

Konstantin Milyutin


1 Answers

Had similar problems mvn install discovers test, mvn test does not

like image 87
Tony Murphy Avatar answered Nov 15 '22 05:11

Tony Murphy