Tuesday, February 28, 2017
A Grails JUnit 4 test template
A Grails JUnit 4 test template
Grails 1.3 upgrades the bundles JUnit to the newer JUnit 4 API. However, the test template used to generate classes by the Grails create-* scripts is still very JUnit 3-ish. Heres a replacement that will generate a skeleton test using JUnit 4 conventions:
To use this just run grails install-templates
then copy the contents over the file src/templates/artifacts/Tests.groovy. You can delete anything else in the src/templates directory that you dont need. Then every time you use a Grails command such as grails create-service foo
the generated test will use the JUnit 4 template.
Available link for download