New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scalatest maven plugin doesn't honour maven.test.skip #466
Comments
+1 our team would also find this useful |
+1 |
+1 my build just failed because maven didn't compile the tests because I specified this parameter, and then scalatest tried to run a class file which didn't exist :( |
+1 seems like using both |
@ryan-williams Yeah, I found that workaround too; worth noting that that will do the trick, but it does seem scalatest doesn't properly support -Dmaven.test.skip |
@dantwining, I have not been able to reproduce this in simple tests I have tried (e.g. "mvn -Dmaven.test.skip=true clean test" with a simple project does seem to skip the tests); so the problem may involve a more complicated scenario. Could you let me know what maven version and command line you are using (or even better a project w/ pom that exhibits the problem) so I can further try to reproduce the issue? @giftig, could you clarify which parameter you used? "maven.test.skip" is supposed to skip compilation, while "skipTests" is not. [http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html] |
@rfries I used both flags, which caused test compilation and running to be skipped. Just using the maven.test.skip flag had no effect on scalatest; maven didn't compile the sources, but scalatest assumed it had and tried to run the test suites. Since the tests aren't even compiled with maven.test.skip specified, that flag should also imply -skipTests to scalatest, IMO. |
@giftig, I set up a simple mixed scala/java project using the plugin, and at least in that scenario, -Dmaven.test.skip is skipping the tests. However, there is a definite difference in how the runner is handled depending on which flag I use. With -DskipTests, the runner doesn't run at all, and there is just a message at INFO that says "Tests are skipped." However, with -Dmaven.test.skip, the runner actually starts, but it never selects any tests (when this happens, it prints "Run starting. Expected test count is: 0" near the top of the runner output, and number of tests succeeded, failed, etc are all 0). I would like to figure out if there is a maven configuration issue that is responsible for the different results we are seeing... the pom.xml I am using is here: https://gist.github.com/rfries/04843afa7b71853146aa Can you provide some more information about the project you are seeing this issue in? |
@rfries The project is a private one, I'm afraid, but a detail which may be important is that my pom specifies the class names of suites to run directly - I suspect it may be seeing that and trying to run that class despite the class not being compiled.
Presumably in the absence of directly specifying the suite, it will try to find classes to run, and since they haven't been compiled, not find any. |
If this helps, we're seeing this issue in the following pom: https://github.com/factorie/factorie/blob/master/pom.xml Perhaps I should open a separate issue, but another related problem, which is not resolved by |
Thanks for letting us know about the specific test syntax, and also the link to the pom. We'll try again to reproduce it. We have this year unfortunately been trying to get the overwhelming task of finishing the 3.0 release and have not had many cycles to deal with the issues. After the 3.0 release we will do an issue fixing release. |
Is this fixed ? |
This is still a big problem as we want to ignore the tests for mvn deploy. This issue has been reported in 2014! Any chance of getting it done? |
yep, we are having this problem as well, any prospect of getting it done? |
This is such a basic requirement that's been open since 2014. Can I contribute a pull request? |
Please use the below workaround. |
You an add your own Maven property, then parameterize the <project ...>
<properties>
<skipTests>false</skipTests>
</properties>
...
<build>
<plugins>
<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>
<skipTests>${skipTests}</skipTests>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Now you can run |
+1 the above workaround worked for me. |
|
This profile automatically converts <profile>
<id>skipTestsProfile</id>
<activation>
<property>
<name>maven.test.skip</name>
<value>true</value>
</property>
</activation>
<properties>
<skipTests>true</skipTests>
</properties>
</profile> |
It seems impossible to skip the running of scalatest.
From http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html "maven.test.skip is honored by Surefire, Failsafe and the Compiler Plugin." - I would expect scalatest to honour this also.
(background - due to some unknown compatibility, some unrelated scalatest tests are failing to run for some developers on our system. we need to be able to skip tests in order to build locally whilst the problem is identified/resolved)
The text was updated successfully, but these errors were encountered: