Chapter 9. Building reliable applications

 

This chapter covers

  • The mechanics of running tests in Grails
  • Test types and phases
  • How to write unit tests with mocks
  • Browser-based testing with Geb

You’ve made good progress with the Hubbub application, and you’ve seen all the core elements that make up a standard Grails application. The question now is how to further develop the application while ensuring that you don’t introduce bugs—or at least as few as possible.

The answer is through testing! Throughout the first part of the book we used test cases to explain how bits of Grails work and to help you get into the testing habit. It’s time to take stock and learn more about Grails’ support for writing various tests so that your own projects can benefit from them. You’ll find out how the unit test framework works and how to decide between different types of tests. And throughout you’ll continue to use Spock, because it’s ideal for all levels of testing.

Let’s begin by looking at the testing infrastructure.

9.1. Running tests

9.2. Understanding Grails unit tests and mocks

9.3. Testing the application as a whole

9.4. Summary and best practices

sitemap