What Mr. Spock would possibly say about modern unit testing
summary
Compares Spock 1.0 (1.1 incoming) with JUnit/TestNG and shows concrete wins: given-when-then blocks replace comment scaffolding, rich assertions print collection diffs, and mocking/stubbing syntax is typically ~2x shorter and supports static methods and call-counts like 3 mock.method(_). Demonstrates data-driven tests with data tables and @Unroll* producing per-row reports, an old() helper for before/after comparisons, polling for async, and seamless JUnit runner integration so existing CI and report tools work. Notes JUnit remains dominant (≈2/3 of GitHub Java projects) and community-maintained status.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 3:40Current testing overview
- 9:49Why Spock is the future
- 13:03Spock test structure
- 20:09Test blocks and benefits
- 27:18Spock vs JUnit
- 32:00Mocking in Spock
- 35:56Async code testing
- 38:05Managing test suites
- 42:39Spock advantages
- 46:18When not to use Spock
- 47:43Getting started with Spock
related talks
29mWhy I prefer Spock over JUnit
47mSpock vs JUnit 5 - Clash of the Titans
01h 12mUnit Tests as a Specification
42mSpock vs JUnit 5 - Clash of the Titans
18mSpeedup unit testing with the Spock framework
35mThe Groovy Way of Testing with Spock
45mWhy Use Spock Instead of JUnit Mockito for Your Java Tests
46mEasy testing with Spock
