Testing Our Domain Class
As mentioned earlier, Grails makes it easy for us to do the right thing by generating test classes for us, but we still have to write the tests. So, let’s add a test for our TekEvent class.
Grails includes the JUnit testing framework wrapped in Groovy goodness, along with the Spock specification framework. When we created our domain class, a Spock test class was created for us in the test/unit directory.
By default Grails provides two types of testing, unit and integration.[18] (The test Grails generated for TekEvent is, of course, a unit test.) Since the goal of a unit test is to test a single class in isolation, Grails unit tests do not provide access to any of the dynamic behavior that would otherwise be available. ...
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.