Since the Scala plugin doesn't recognize ScalaTest unit test's I call the
Ant task "org.scalatest.tools.ScalaTestAntTask"
However, I'm kind of groovy illiterate and do the gradle scripting copy past
style and need some hints how to copy better :)

This is what I came up with:
task scalatest << {
  ant.taskdef(
          name: 'scalatest',
          classname: 'org.scalatest.tools.ScalaTestAntTask',
          classpath: configurations.compile.asPath + ':' +
compileScala.destinationDir
  )
  ant.scalatest(
          runpath: 'build/classes/test',
          haltonfailure: 'true',
          fork: 'false'
  )
}

1: I'm not happy about the runpath value, is there a better way to refere to
the compiled tests?

2: Then there are tags inside the scalatest ant declaration (ie. reporter),
how do I set these?

   <target name="test" depends="">
     <taskdef
name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
       <classpath refid="scalatest.classpath"/>
     </taskdef>
     <*scalatest* runpath="${test.classes} "
haltonfailure="true" fork="false">
        *<reporter type="stdout" />*
     </scalatest>

3: I would like to snap my scalatest task into the test phase, how is this
done?

4: The scala build are a little slow, ~10sek can be a very long time when
you do TDD, any tips on how to make it run faster?

Last, I'd like to suggest adding something like this scalatest task to the
Scala Plugin section in the documentation, it is nice to have working
examples how to extend gradle's capabilities in context, and now that the
"run a program" is fixed so that you doesn't need ant for that, this could
be another...

Regards,
David Rosell

Reply via email to