Chapter 7. Building reliable applications

 

In this chapter

  • Why you should do testing
  • How to test different parts of your application
  • Choosing between different testing strategies

We’ve introduced all the main components of a Grails application, and you have learned more than enough to start developing some useful and usable applications. You’re probably highly motivated to get coding and experimenting! And while your motivation is high, it makes sense to take a step back and look at how you can improve the quality and reliability of your applications through testing.

7.1. Why should we test software?

There are two approaches to writing software that works as it should: correct by design and correct through testing. Those in the former camp believe that you can design software to be correct from the outset. This philosophy has yet to penetrate the commercial sector to any great extent, but its counterpart, demonstrating correctness through testing, has become immensely popular in recent years.

7.2. Unit testing

7.3. Integration testing

7.4. Functional testing

7.5. Summary and best practices