Tag

API Testing Archives ⋆ james-willett.com

How to Effectively use Groovy GPath in REST Assured – Part 2: GPath JSON

By | Rest Assured | 7 Comments

In part 1 of this series on how to effectively use Groovy GPath in REST Assured, we gave an overview of Groovy. We also covered installation options, the Groovy playground, and some of the basic concepts that will be useful to us for GPath in REST Assured. For part 2, we are going to focus purely on working with GPath JSON in REST Assured. Although XML continues to be widely used amongst APIs…

Read More

How to Effectively use Groovy GPath in REST Assured – Part 1: Overview of Groovy

By | Rest Assured | 6 Comments

Currently I am working on a video tutorial series for REST Assured. One of the topics that I will cover in-depth is how to use GPath in REST Assured properly. I figured I would publish a series of posts on my blog as a warm up to the topic. When working with REST Assured you will almost certainly at some stage want to extract values from elements and perform assertions…

Read More

Specification Re-use in Rest-Assured with ResponseSpecBuilder and RequestSpecBuilder

By | Automation, Rest Assured | 7 Comments

When you are writing tests against your API in Rest-Assured you might have some common expected results that you want to check every single time that you call the API. For example, look at the very simple test below: @Test public void testSomeApi() { when(). get(“http://yourWebsiteAddress.com/someAPIcall”). then(). statusCode(200). body(containsString(“Your Website Title”)); } What this test is doing is calling the ‘someAPIcall’ on ‘http://yourWebsiteAddress.com’ and then checking that the status code…

Read More

Going Further with Rest-Assured – Part 2: Parameterised Testing with JUnitParams

By | Automation, Rest Assured | 5 Comments

In part 1 of this series on Going Further with Rest-Assured, we looked at creating classes for our test data within our test code and then saw how we can put that data into a Java Map. We also took some example JSON and used Rest-Assured to create another Map of that data, so that we can compare the two. This post will follow on directly from the last one…

Read More

Going Further with Rest-Assured – Part 1: Writing and Using Test Data in your Framework

By | Automation, Rest Assured | 5 Comments

In the previous blog post we looked at how we can extract data from an API call directly into our tests using Rest-Assured and had a look at a couple of basic tests that we could execute against that data. One small issue with the previous post is that we did not have an actual API that we could use (unless you happened to have access to one), but I…

Read More

Extracting a JSON Response with Rest-Assured

By | Automation, Rest Assured | 30 Comments

In the previous blog post on Getting up and Running with Rest-Assured, we went over everything that we needed to get up and running quickly. In this post I am going to focus on a couple of features of Rest-Assured that I use regularly. The first feature is extracting a response from an API call into a ‘Response‘ class. Once we have extracted the response, we can perform various tests…

Read More

Getting up and Running with Rest-Assured

By | Automation, Rest Assured | 11 Comments

Testing APIs directly is becoming a bigger trend in the Test Automation world. A great open-source Java library that I have been using for this testing, with great success, is Rest-Assured. In this blog post, I am going to cover everything that you need to get up and running quickly with Rest-Assured. So just what exactly is Rest-Assured? Rest-Assured is an open-source Java Domain-Specific Language (DSL). It eliminates the requirement…

Read More