Closed benedictleejh closed 9 years ago
I think this may be a duplicate of https://github.com/maiflai/gradle-scalatest/issues/12 - please could you upgrade to Gradle 2.2 and see if the issue remains?
I upgraded to Gradle 2.2.1, and it works fine. Thanks for the quick reply.
Perhaps noting somewhere that the plugin doesn't work with some versions of Gradle (maybe in the readme) might be helpful, as it would help people dealing with the same issue.
Any ideas if multi-module builds are supported?
I have similar issue, where gradle test
does not run any scala tests (I added id "com.github.maiflai.scalatest" version "0.6-5-g9065d91"
to the list of plugins)
However, $ gradle clean scalaTest
seems to be defined, but it hangs after:
:my-project:scalaTestConsole
Failed to created JLineReader: java.lang.NoClassDefFoundError: scala/tools/jline/console/completer/Completer
Falling back to SimpleReader.
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
> Building 94% > :my-project:scalaTestConsole^C
Any ideas what can cause scala tests not to run with gradle test
and why $ gradle clean scalaTest
is hanging?
Thanks,
$ gradle -version
------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------
Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_45 (Oracle Corporation 25.45-b02)
OS: Mac OS X 10.9.5 x86_64
Hi,
I'm not aware of any specific issues with multi-module projects.
Gradle has automatically expanded scalaTest
into the scalaTestConsole
task, which launches a REPL with your test runtime classpath. I seem to recall that you need to launch gradle with --quiet
and then you can enter arbitrary scala code for evaluation.
Please could you share your repository so that I can see if there is any obvious reason for tests not being run?
Thanks, Stu
On investigation from gradle init --type scala-library
you need to do two things to use this plugin:
// add the plugin
plugins {
id "com.github.maiflai.scalatest" version "0.6-5-g9065d91"
}
// add the html reporting dependency
dependencies {
...
testRuntime 'org.pegdown:pegdown:1.1.0'
...
}
Once you've done that it's important to run clean test
otherwise gradle assumes that the previous run of the test
task does not need repeating.
I then receive the following output:
:test
Discovery starting.
Discovery completed in 104 milliseconds.
Run starting. Expected test count is: 1
LibrarySuite:
- someLibraryMethod is always true (18 milliseconds)
Run completed in 223 milliseconds.
Total number of tests run: 1
Suites: completed 2, aborted 0
Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
All tests passed.
@maiflai Thanks for checking on this. I've tried similar experiment, only after creating an initial project I tried to add an actual scalatest, in src/test/scala/HelloSuite.scala
and it was not discovered with gradle clean test
.
Somehow a gradle project created like this does not play well with Intellij Idea, I'm still finding ways to make Idea import it correctly (setting classpath and dependencies properly)
I've not seen that behaviour to be honest; I use Idea constantly and I've found it reliable recently. I think they fixed some things in 14 and I've since been able to use the plugin.
Are you on a recent build?
Closing old issue.
When I create a new project using
gradle init --type scala-library
, removing the RunWith JUnitRunner for the test, runninggradle test
results in no test output to the console, and the test report shows no tests having been run.This is the build.gradle:
I'm on Gradle 2.1, and JDK 8