task scalaTest(dependsOn: testClasses) << {
description = \'Runs Scalatest suite\'
ant.taskdef(name: \'scalatest\',
classname: \'org.scalatest.
You can put the following in your build.gradle
:
task spec(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-o']
classpath = sourceSets.test.runtimeClasspath
}
Note: The path my be different depending on the gradle version as pointed out in the comments by @MikeRylander. Before gradle 4 it used to be 'build/classes/test'.
Then just run gradle spec
to execute your tests.
I named the task spec
because there already is a test
task. Dunno if you can override the default test task.
You can look up the available options here.