Spock for Groovy – IV

In this last post of using Spock with Groovy, let’s learn to use mock objects. We’ll continue to use the Calculator class. The Calculator class has the add method that returns the sum of two numbers. Let’s modify the add […]

Spock for Groovy – III

Continuing with the series of posts on Spock framework for Groovy, let’s discuss testing the exceptions for the Calculator class. The Calculator class with two methods add and divide are given below. //Calculator.groovy class Calculator { def add(num1,num2){ num1 + […]

Spock for Groovy – II

In the previous post, we got introduced to Spock framework. We created a Calculator class with an add method and a spec called CalculatorSpec with a feature to test the add method. Let’s add some more test features in our […]