5

There is a web API (RESTful) which is used by our mobile applications. Untill now we were manually testing it through mobile devices. Now, as per our client requirement, we need to automate the process.

Performance testing is one of the important tasks.

My problem is: I don't have an idea of how web API's work.

As of this my questions are:

  • What questions should I ask the developers so that I can proceed with automating?
  • Which tools should I consider from JMeter and SOAPUI? (Costs are not an issue)
4

5 Answers 5

3

What questions should I ask the developers so that i can proceed with automating?

It depends what kind of test you want to have, if it is only end2end testing then "Base URI" should be enough for you. If you need to test more than that (e.g Tests which need mocking), you may need to have access to the project code to add your test code there.

  • For performance Testing JMeter and Grinder could be useful.
  • For end2end API testing, I found Frisby very easy to config and use.
  • For tests which need to be close to the application code (e.g. Mocking dependencies), then you can go with rest-assured (java).

As far as I know, all of them could be integrated to the well-known CI tools such as Jenkins, BAMBOO etc.

1
  • For the REST API testing you can also use HTTPMaster and Postman, they are good & popular tool for REST testing. httpmaster.net getpostman.com For performance "Sallaneh" has already mentioned good tools.
    – Dhiman
    Aug 14, 2015 at 20:47
2

I believe for your second question you have enough and more answers so I'm not going to touch base on it.

Coming to your first question, I.e what questions you need to ask, sharing some of my experience

  1. A proper API testing is possible only with adequate documentation. Not sure whether your organisation has technical writers to document the features or developers do it.
  2. Technology used : Soap or Rest
  3. Are we going to expose the API to third party or is it going to internal I.e whether it is an outbound or Inbound API
  4. What kind of Authentication mechanism will be used?
  5. What kind of versioning approach will be followed. Say one client needs one additional node.
  6. Will the APIs follow a workflow? If yes, will the workflow differ for different clients.
  7. What kind of actions performed, GET,PUT, POST etc
  8. Will the API be restricted to a country or region?
  9. Will the API support Multi language?
  10. Always ask for Benchmark , even if the developers are not interested, and, do capture the Performance.
  11. What kind of validation/ testing is expected from stakeholders (point of view) would help. In certain instances, structure validation is sufficient and in some, data too needs to be validated.
  12. Need to set up a Mock Server to receive and mimick responses.

In our team, we use JMeter as we have need to perform headless execution as well and Performance plays a role.

Since I didn't have clue on your company's line of business, shared some of my perceptions.

1

First of all, you should ask from developers the API Documentation and understand it. Then prioritize the cases after discussion with them.

I would suggest using Rest Assured which is a Java Library to test Rest API. You can integrate it with your existing UI Testing Framework if you have one. Below is the example of automating GET Request using Rest Assured:

import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static com.jayway.restassured.RestAssured.*;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;

public class GetStatusCodeTest {

 @BeforeClass
 public void setBaseUri () {

  RestAssured.baseURI = "https://maps.googleapis.com";
 } 

@Test
public void testStatusCode () {

  Response res = 
  given ()
 .param ("query", "restaurants in mumbai")
 .param ("key", "Xyz")
 .when()
 .get ("/maps/api/place/textsearch/json");

 Assert.assertEquals (res.statusCode (), 200);
 }

}

Here we check whether the response code is 200. If yes then the test has passed.

A detailed tutorial on Rest Assured can be found at below link:

https://restservicestesting.blogspot.in/

2
  • Please do not post identical answers on multiple places. It would be better to mark Q as duplicate. Keep stack Clean & Clear Nov 7, 2016 at 11:11
  • Some part of the answer would be same but not all of it. Nov 8, 2016 at 12:11
1

Try Katalon automation tool. It is open source free and reliable. Installation is simple. To configure and how to PERFORM API Testing using KATALON you can refer these article from mundrisoft or KATALON

0

Disclaimer: I'm using APICombo

I hope I don't misunderstand your question, you can use APICombo to do JSON or XML response validation. You can also schedule the test to run so it can check automatically for you. You can check the documentation here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.