Home - essenius/FitNesseFitSharpRest GitHub Wiki

Welcome to the FitNesseFitSharpRest wiki!

Testing REST APIs

Introduction

I'll assume you know what REST is, but if you want to brush up your knowledge, a nice introduction is available online.

The structure of the content of requests and responses is not prescribed by the REST architecture, but two common formats are XML and JSON. Another format in use now and then is plain text.

REST APIs are the entry point for the functionality of your services, and therefore they need to be tested well. Since REST services only use standard HTTP services, they can be tested to some extent with almost any HTTP capable client. You could even use a browser. Many people use tools like Fiddler to craft requests, send them to the server, and inspect what comes back. That works very well for experimentation, but it is labor intensive. If we want to test REST services on a daily or even more frequent basis, then we need more automated approaches.

Another approach that many people take is to create unit tests that execute the REST services. You need to test your REST services anyway during developer testing, where unit testing frameworks are in use already. That is a lot better from a repeatability perspective, since you can execute the tests automatically. But unit testing frameworks focus on developer testing, not on acceptance testing. Changing the tests, and making them work in different environments, tends to be quite involved. You really need to craft these unit tests very carefully to make them flexible enough. Furthermore, they are not very tester friendly – especially if the tester has limited coding skills.

FitNesse to the Rescue

FitNesse was intended to perform automated functional acceptance testing at the API level of applications – which is exactly where REST services are positioned. A FitNesse fixture can take care of handing the low-level communication matters, and expose a set of fixture methods that allow testers to create their scenarios to test the services without the need to know exactly how this works technically.

This repo contains a fixture that allows you to test REST services and examine the payloads. It supports XML, JSON and plain text payloads.

Let's get started with the different types of REST Requests. Or go directly to Handling JSON , XML or Text payloads. You can also check the Reference.

Acceptance Testing Wiki