CHAPTER 7: Rapid Web Development with Grails 319
Note In this way you can augment the unit test for your Controller in the ControllerTests generated by Grails.
Figure 7-17. Test report: passed test
The test passed because in Listing 7-6 the assertion made on line 3 was correct. Now replace line 3
in Listing 7-6, as shown here:
assert "xyz" == response.text
This is an incorrect assertion, because the simple textual response shown in Figure 7-15 is “book
list” and not “xyz.” So this test should fail. To see how Grails reports the failed test, fail the test by
replacing testSomething() with Listing 7-7.
You can generate the report illustrated in Figure 7-17 from the path shown in the last line of the
previous output.