Chapter 2. Groovy knowledge for Spock testing

This chapter covers

  • Understanding the connection between Java and Groovy
  • Learning Groovy conventions
  • Comparing JUnit asserts and Groovy power asserts
  • Using Groovy utilities for common testing needs
  • Obtaining test data with Groovy

Learning a new programming language is usually a daunting task. You must study a new syntax, new concepts, and new libraries all at once to be productive. If you’ve spent too many years with a single language, several concepts are so entrenched that having to “unlearn” them poses a big barrier to any alternative (even if it’s objectively better). With Groovy, this isn’t the case because Groovy is a cousin language to Java. Much of your current knowledge can be reused and ...

Get Java Testing with Spock now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.