This page looks best with JavaScript enabled

Code Long And Test With Spock Unit Tests

 ·   ·  ☕ 1 min read

Given: “A video about Spock”
Expect: “To learn how to use Spock to test your Java or JVM based projects”

Spock, the next generation of unit testing Java applications. It’s built in and requires Groovy to work but brings with it a lot of stellar features.

Spock works by defining Specifications that contain individual tests. Each test has a set of directives that define the section of the test you are in. The prime directives you’ll use in Spock include ‘given’, ‘when’, ‘where’ and ‘then’ we’ll cover how to use each and how they work together.

We’ll also talk about how you can use the ‘where’ directive along with the @Unroll Attribute to help with the Discovery of tests.

Finally we’ll take a quick look at how you can use Mock’s to replace interfaces within your code and improve test coverage by replacing them with functional fake implementations.

After this short trek into the basics of Spock you’ll be able to bring it to your Enterprise even if this is your first contact with the framework.

Learn more about Spock and how to get started at their website: http://spockframework.org

Discord: https://discord.gg/hU5Kq2u


Sam Wronski
WRITTEN BY
Sam Wronski
Maker of things and professional software engineer. Lets make something awesome together!