Why Use Spock Instead of JUnit Mockito for Your Java Tests
summary
A comparison of Spock (the Groovy-based testing framework) vs JUnit + Mockito for Java tests, showing real side-by-side test code to highlight what you gain and lose by using Spock. Also covers how common Java unit/integration testing best practices change when using Spock—which practices become less important, which new ones appear, and how tests become more focused on intent.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 2:59Spock basics and Groovy
- 7:38Test structure and DSL
- 15:06Mock creation differences
- 19:40Mock interactions and verification
- 24:12Property-based tests
- 28:06Configuration and strings
- 30:55Named parameters and builders
- 34:06Private methods vs inline
- 35:52Collection literals
- 37:18Spock pros and cons
- 40:51Overcoming change resistance
- 42:02Q&A
related talks
51mSpock Framework: The Ultimate Framework for Testing Your Java Applications
46mEasy testing with Spock
46mSmarter Java Testing with the Spock Framework
35mThe Groovy Way of Testing with Spock
29mWhy I prefer Spock over JUnit
42mSpock vs JUnit 5 - Clash of the Titans
47mSpock vs JUnit 5 - Clash of the Titans
44mSpock vs JUnit 5 - Clash of the Titans
