Tuesday, October 25, 2016

Tools for API REST testing

Sometimes we have to test some feature on the fly, especially if you are supporting more than one team on QA. I already showed how to test APIs with java and Apache libraries, but you my find yourself in a moment when you don't have your code at hand. Then, what to do?
Fortunately, there are some options for this. I´ll check a couple of them.


Postman is a Chrome and Mac add-in that allows us to work with all kind of API requests. This is a great option for QA, since it has a comprehensive set of options displayed through a nice UI. But let's play a little with a request:

1. Download Postman here.
2. Install it.
3. Open Postman. You should see something like this:

4. For this example, we'll use the pubic API from https://httpbin.org/. So, let's make some GET requests: Paste the following in the main text box: http://httpbin.org/gzip (Returns gzip-encoded data). Make sure that the request is a GET, and then press Send. The result should be displayed in JSON format, like this:

Postman is a comprehensive tool with many options. However, these are the features I liked the most:

History: This is especially useful when you do a lot of requests with different URLs. Sometimes it's hard to keep track of the URLs and configurations, but you can check any past request if you need to in the History:
Request history

Multiple tabs: You can open new tabs, each one with the particular set of options you set. This is useful when you need to copy or compare parameters from different requests, like copying an authentication token.
Multiple tabs

Postman is a great tool, with many advanced options that can help both developers and QAs. However, what if you can't install Postman for some reason? Some organizations have the access to the Chrome store blocked, and contacting IT just for a quick fix might not be always the answer.

Online REST test

There are many pages to do simple requests. These do not have many options or advanced configuration, but they might be helpful to some tests on the run. Examples:

REST test test

You can find this tool at https://resttesttest.com/. To make requests with this tool:

1. Open the page.
2. Select the method. In this case, it's GET.
3. Select the endpoint. We will use the URL we used before (http://httpbin.org/gzip).
4. Press Ajax request.
5. You should see the same response than the one you obtained with Postman.

These tools are not uncommon in internet. For example, you can also use this: https://www.hurl.it/, which will give you most of common options for these tools (Add authentication, header, parameters, etc.):

0 comentarios:

Post a Comment