1

I am new to maven and trying to make it work with ScalaTest. In my pom.xml, I disabled sunfire and enabled the maven scala test plugin. (As in the link below)

I also put the tags for sourceDirectory and testSourceDirectory

    <sourceDirectory>src/main/scala</sourceDirectory>
    <testSourceDirectory>src/test/scala</testSourceDirectory>

Here are my folders:

src
 - main
   - scala
     - lot.of.packages
       - utility
         * ClassName
 - test
   - scala
     - lot.of.packages
       - utility
         * ClassNameTest

I am trying to run the tests with mvn test

The problem is that Maven does not discover the tests.

Discovery starting.
Discovery completed in 272 milliseconds.
Run starting. Expected test count is: 0

The strangest thing is if I run manually the test in the ide (Intellij), then it does discover the test with mvn after.

But if I add a new test, once again it does not discover the new test (might be a cache problem?)

I already looked there, but I did not find any answer Maven not discovering ScalaTest unit tests

If there is any information missing, comment below I will add them

Thanks

BlueSheepToken
  • 5,751
  • 3
  • 17
  • 42

2 Answers2

1

In the net.alchim31.maven:scala-maven-plugin:3.1.6 plugin, adding <goal>testCompile</goal>in the compile execution phase is a workaround, not the solution but good enough for the moment.

BlueSheepToken
  • 5,751
  • 3
  • 17
  • 42
0

Can you check the configuration of maven-surefire-plugin ? The default includes of this plugin are

<includes>
    <include>**/Test*.java</include>
    <include>**/*Test.java</include>
    <include>**/*Tests.java</include>
    <include>**/*TestCase.java</include>
</includes>

Check the officiial documentation : https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html

Souhayl
  • 21
  • 4
  • I actually disabled surefire, to use the scala test maven plugin. But you are answer might be the beginning of an answer (use the tags includes in the scala test plugin) I am going to check how to use it – BlueSheepToken Oct 11 '18 at 14:08