Integration Testing

We create an integration test by running the Grails script create-integration-test. An integration test is a Spock specification or JUnit test case, just like a Grails unit test. The difference is in what is available to the test at runtime. Unit tests are meant to test a unit (class) in isolation, so Grails doesn’t give unit tests any of its dynamic goodness. Integration tests are meant to test multiple classes working together. When running integration tests, Grails adds all of the dynamic behavior that we’re taking advantage of in our application.

Since the process of adding default tasks to an event involves the TaskService, Task, and TekEvent classes, an integration test is a good fit. Run the create-integration-test ...

Get Grails 2: A Quick-Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.