On 06/03/2011, at 8:30 AM, Kevin Stembridge wrote: > Hi all, > > From the documentation for the Java plugin, I assumed that I didn't need to > do anything special for my TestNG tests to be run. > > http://gradle.org/java_plugin.html > > > "It automatically detects and executes all unit tests in the test source > > set. It also generates a report once test execution is complete. JUnit and > > TestNG are both supported." > > But my tests were not being run. Debug output showed that a Junit scanner was > being run but nothing for TestNG. I added the following to my subprojects > configuration and the tests are now being run: > > tasks.test.useTestNG() > > > So my questions are: > > Is TestNG support supposed to be enabled out of the box?
Not at the moment. The Java plugin assumes that you want to run junit tests unless you explicitly say otherwise, by calling test.useTestNG(). There's been some discussion on the mailing list about this behaviour, and we'll probably change it so that Gradle will run all junit and testng tests that it finds. > Is the documentation correct? Sort of. It is a bit unclear about using testng, however. > Is my fix the correct approach to enable TestNG tests? Yes -- Adam Murdoch Gradle Developer http://www.gradle.org Co-Founder and VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting http://www.gradleware.com
