Junit Archives - james-willett.com

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

By | Automation, Rest Assured | 9 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 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 | 48 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 . REST Assured Fundamentals – Out now on Udemy! My Udemy course on REST Assured Fundamentals is out now on Udemy. For readers of…

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

Some Basic Junit to Help Your Automated Testing

By | Automation | 2 Comments

In the last post (here) we ran our first Selenium automated test, and we felt good about it! However, straight away we spotted a weakness in the testing, namely that when a test failed the final line of the test (that closed the browser) was not executed and we were left with the browser open. In this post we are going to learn just a little bit more about Junit…

Read More

A Gentle, Newbie-Friendly Guide to Installing Selenium WebDriver – Part 3: Get Testing!

By | Automation, Selenium | 17 Comments

In Part 2 (here) of this guide, we went through downloading the Intellij IDE and installing Selenium and Junit through Maven. This is all we need to get started with writing automated tests, so let’s go ahead and jump straight in! Before we go on, I am going to assume that you have the Firefox browser installed. If you don’t, go ahead and download it (here). Firefox is a great…

Read More

A Gentle, Newbie-Friendly Guide to Installing Selenium WebDriver – Part 2: Get Intellij!

By | Automation, Selenium | 12 Comments

If you followed the 5-minute “Getting Started with Maven” guide from the previous post (link here incase you missed it), then you should now have Maven installed on your machine. From installing Maven, you should inturn also have installed the JDK on your machine. If not, go and check the Maven guide and come back here once you have the JDK and Maven installed. We are now ready for the…

Read More