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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access