Is Groovy Better for Testing than Java?

Two years ago, we introduced Spock tests into the MongoDB Java driver. The decision could be considered controversial – the project used no external dependencies in production code, and was 100% Java. But there was a back door… with Gradle as the build system, there was a tiny excuse to use Groovy in the project, provided it was not in the production code. That was all the excuse we needed to start using Spock for unit and later, integration tests.

Groovy has a lot of advantages as a testing language, and with Spock’s mocking, stubbing, and data driven testing features, it might seem as if this is the perfect way to write tests. This session covers some of the features that make Spock (and Groovy) compelling for writing tests. But in the interests of fairness, it also discuss some of the downsides and the times when Java was chosen instead.

Video producer: