Chapter 1. Introducing the Spock testing framework

 

This chapter covers

  • Introducing Spock
  • Bird’s-eye view of the testing process
  • Using Groovy to test Java
  • Understanding Spock’s place in the testing world

We live in the computer revolution. We’ve reached the point where computers are so commonplace that most of us carry a pocket-sized one all the time: a mobile phone. Mobile phones can now perform real-time face recognition, something that used to require a mainframe or computer cluster. At the same time, access to cheap and “always-on” internet services has created a communication layer that surrounds us.

As we enjoy the benefits of computerized services in our daily lives, our expectations are also changing. We expect information to be always available. Errors and unexpected behavior in a favorite software service leave us frustrated. E-commerce is on the rise, and all brands fight for customer loyalty as we turn to the internet for our shopping needs. Once I ordered a single chair from a well-known furniture company, and my credit card was charged three times the amount shown on the product page because of a computer error. Naturally, I never bought anything from that online shop again.

These high expectations of error-free software create even more pressure on developers if the “user” of the software is an organization, another company, or even a government agency. Software errors can result in loss of time/money/brand loyalty and, more important, loss of trust in the software.

1.1. What is Spock?

1.2. The need for a testing framework

1.3. Spock: the groovier testing framework

1.4. Getting an overview of Spock’s main features

1.5. A first look at Spock in action

1.6. Spock’s position in the Java ecosystem

1.7. Comparing Spock and JUnit

1.8. Summary

sitemap