Wednesday, May 27, 2015

Groovier Spring Boot Integration Testing

Recently I had a chance to use Groovy’s groovy.json.JsonSlurper in a soapUI REST project. The usage scenario in soapUI (in particular, soapUI Open Source) was very simple: in a Groovy assertion, load the content of a response into a variable and than verify it like this:

import groovy.json.JsonSlurper;

def slurper = new JsonSlurper()
def result = slurper.parseText(messageExchange.responseContent)

assert result.incidentType == 'Lorem ipsum'

This works well in soapUI. But what about Spring Boot integration tests? Can I make integration testing of REST API groovier?