Gradle 0.6 supports TestNG

Gradle 0.6 was released today ! Among other stuff Gradle now supports execution of TestNG tests.

[UPDATED 24.11.2009 check Gradle Cookbook for some TestNG tips&tricks]

Below I put the minimal build.gradle file that can be used to execute TestNG tests with Gradle. The user guide of Gradle is not complete yet, so this snippet can help you to start using Gradle with TestNG.

At the same time you can see here how concise Gradle's build files can be.


repositories {

dependencies {
    testCompile "org.testng:testng:5.8:jdk15@jar"

test {

IMPORTANT - this works with Gradle 0.6. Gradle is evolving fast so check the documentation of the latest version because changes might be introduced.

P.S. Thx to G. Boissinot for tip on default values.


More values by default

In addition, in Gradle 0.6, the values of "sourceCompatibility" and "targetCompatibility" are by default "1.5". So, in your example, these elements are optional.

G. Boissinot

Thx, I've updated the code

Thx, I've updated the code

This used to be my blog. I moved to long time ago.


Please comment using