O'Reilly logo

Grails 2: A Quick-Start Guide by Ben Klein, Dave Klein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required