views:

299

answers:

2

I have an Eclipse project with many unit tests written in Groovy. I can run the tests in each individual class using Eclipse's GUnit run configuration. I open this configuration, select the "Run a single test" radio button, and select the class whose tests I want to run. This works fine, however I want to run all of the tests in the the project at once.

When I open my run configuration, select the "Run all tests in the selected project, package or source folder" radio button and select my project, Eclipse gives the error "No tests found with test runner 'JUnit 4'."

How do I get Eclipse to run all of the tests in my project?

+1  A: 

Figured this out with the help of the documentation. Groovy has a utility class groovy.util.AllTestSuite. I created a new GUnit run configuration with this as my test class and added VM arguments like this:

-Dgroovy.test.dir=src -Dgroovy.test.pattern=**/*Tests.groovy

I also had to add ant.jar and ant-launcher.jar to the configuration classpath. That configuration happily runs all my tests.

Ben Williams
+1  A: 

Please upgrade to the Alpha version of the groovy-eclipse plugin V2. You can run all unit tests in a project by right-clicking and selecting Run as->JUnit. In the new version of the plugin, Junit tests are treated identically whether they are written in Java or Groovy.

Andrew Eisenberg