Plugins You can find out about all the publicly available Grails plugins.

Domain Expectations

  • Tags: testing
  • Latest: 0.6.1
  • Last Updated: 08 May 2011
  • Grails version: 1.1
  • Authors: null
2 votes
compile "org.grails.plugins:domain-expectations:0.6.1"

 Documentation  Source


A test framework that allows you to test your domain/command constraints by defining expectations within a unit test or integration test.


grails install-plugin domain-expectations



The Grails Domain Expectations Plugin is a Grails plugin which was written to help make developers' lives easier when writing domain constraints in a Test Driven Development (TDD) fashion.

When writing a test using the Grails Domain Expectations Plugin, a developer expresses their intent by stating an expectation. An expectation is comprised of the name of the property to be affected, the constraint to be applied, and the parameter value(s) which are necessary for the constraint to work.


The primary goals of this plugin are:

  • Ensure continuity between your domain specification and domain class implementation (unit)
  • Ensure continuity between your domain specification and domain entity implementation (integration)
If you always generate your data model from your domain classes then the first goal will be sufficient. However, if you can't generate your data model from source because you are either working with a legacy database or you are supporting a production Grails application, then the second goal becomes really important.


Official Documentation and examples can be found here: