Testing Grails
In this presentation we will go over how to test Grails with a few frameworks. Mainly we will go over testing with the out of the box Grails items plus GMock. In addition we will also compare that with testing a suite using Spock and the Spock Grails plugins.
While Grails has made it easy to create web applications for the enterprise, the ability to test those applications has become easier as well. However, the choices for testing like in most frameworks is numerous including the built in testing classes provided by Grails itself. One of the reason why there are many testing options is because there are many parts of a web application to test. This makes it so there is never a one size fits all to testing.
When testing a Grails application there is the domain which will require mostly integration testing. The Services layer which can require a combination of mocking and integration testing. The controller and tag libraries will often require a controller and taglib specific mock testing. And finally there is the GSP pages themselves which require some kind of functional testing that actually tests the web framework itself.
With all these items to test the question becomes what do I use? For this presentation we will walk through two ways of performing testing. The first will be with the testing framework with the standard out of the box Grails tools mixed with GMock in order to mock various parts of the controller and services. Our second set of testing will use Spock, the up and coming Groovy testing framework with the Grails Spock Plugin to test the grails application.
About Joseph Nusairat
Joseph Faisal Nusairat, author of “Beginning JBoss Seam” and co-author “Beginning Groovy & Grails”, is a Java developer who has been working full time in the Columbus Ohio area since 1998, primarily focused on Java development. His career has taken him into a variety of Fortune 500 industries including military applications, data centers, banking, internet security, pharmaceuticals, and insurance. Joseph is particularly fond of open source projects and tries to use as much open source software as possible when working with clients. Joseph is a graduate of Ohio University with dual degrees in Computer Science and Microbiology with a minor in Chemistry. Currently, Joseph works as a Senior Partner at Integrallis Software (www.integrallis.com).
More About Joseph »