Last updated by 5 years ago

Page: Testing Plugin, Version:1

Testing Plugin

Unit testing in the 1.0.x line of Grails is not the easiest thing in the world. If you want to test domain classes, controllers, or even services there are so many things you need to mock and set up. Without a rigorous approach to it test can quickly degenerate into a mess. On top of that, custom meta-class programming sometimes leaks into the integration tests, causing odd failures. This difficulty often results in users going straight for integration tests, despite unit tests having the benefit of speed and the ability to run from within an IDE.

The Testing Plugin targets these weaknesses by providing a set of classes that make testing many of Grails' artifacts really easy, while providing plenty of flexibility.

The classes in the testing plugin are being incorporated into Grails 1.1, so if you have a recent 1.1 SNAPSHOT or revision from the Subversion branch, then you don't need to install the plugin.

Getting started

Installing the plugin is trivial:

grails install-plugin testing