Using Scala and TestNG with Gradle
December 30, 2010
During the christmas holidays i tried out Scala and TestNG with Gradle.
I brushed up my knowledge of the programming language Scala during the christmas holidays. I read the book Programming in Scala by Odersky et al. again and i started to develop some code using the Scala plugin of IntelliJ IDEA 10. If you are programming in Groovy or Scala you really should give IDEA a try. In my opinion it is the best IDE.
Since i am a fan of TestNG i wanted to use it, too. Actually it’s easily usable with Scala using ScalaTest.The following snippet is an example of the
TestNGSuite and the equality
=== which gives an error message it it’s operants are not equal.
As a build tool i used gradle for the first time. And it was not that straightforward, I had to search the web and read manuals for more than half an hour to get this working. The following is the complete build script. My project deviates from the standard directory structure, so i have to declare, that my source code is in
src and tests are in
Lessons learned: At the time of writing the central maven repository has older versions of ScalaTest in the directory
org.scala-tools.testing. Do not use these with the newest TestNG and Scala 2.8. Use the newer version 1.2 from the directory
org.scalatest in the
Remark: This post was adapted to the new blog format in November 2016.