Java Reference
In-Depth Information
You can generate the report illustrated in Figure
7-17
from the path shown in the last line of the
previous output.
Figure 7-17.
Test report: passed test
Note
In this way you can augment the unit test for your Controller in the ControllerTests generated by Grails.
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.