Tag

Java Archives ⋆ james-willett.com

GPath Xml - Title Banner

How to Effectively use Groovy GPath in REST Assured – Part 3: GPath XML

By | Rest Assured | 3 Comments

  This post is the 3rd and final in the series on Groovy GPath in REST Assured, and will focus on GPath XML. View part 1 and part 2 in the series on GPath here. REST Assured uses XmlPath that can be queried with GPath expressions. XmlPath is an alternative to using XPath for easily getting values from an XML document.  A lot of the functionality and syntax that we…

Read More
Intellij through Fiddler - Title banner

Running Intellij traffic through Fiddler

By | Automation | One Comment

I recently ran into a need to capture HTTP traffic directly from my Intellij code (i.e. running in the JVM). I released I didn’t know how to capture Intellij through Fiddler. I.e. the http traffic that my application was generating. Even though I am quite familiar with using Fiddler, I did find this took a while to get working. So hopefully someone else benefits from this post on Intellij through Fiddler…

Read More

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

By | Automation, Rest Assured | 8 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
REST Assured Response Extract title image

Extracting a JSON Response with Rest-Assured

By | Automation, Rest Assured | 39 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 one of the features of Rest-Assured that I use regularly: extracting a response Update Notice (25th Aug 2017) Please be aware that this post is over 2 years old. I have many more REST Assured posts on…

Read More

Getting up and Running with Rest-Assured

By | Automation, Rest Assured | 12 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