CategoriesTesting

Spock Test Framework

Spock aims to be a more powerful alternative to the traditional JUnit stack, by leveraging Groovy features which seamlessly integrate with Java

Spock Features Highlights

  • Highly Expressive
  • Spock enforces a clear test structure
  • BDD style test can be expressive through the “given, when and then” blocks
  • Compatible with all major build tools and continuous integration providers
  • Inbuilt Mocking and Stubbing
  • Parameterized test and Data-driven test ( Data table-based and SQL table-based)

JUNIT -> SPOCK -> CUCUMBER

Spock lies between junit and cucumber

At a glance, the Spock framework is,

  • BDD style testing and specification framework
  • Which runs Junit under the hood
  • For Java and Groovy applications
  • Test case writing in Groovy
  • All three components combine with a single library
    • Unit testing
    • Mocking
    • BDD
Continue reading