How to call external REST API but I don't want to trigger to services provider?


Please briefly explain why you feel this question should be reported .

Report Cancel

Last week, I was asked this question, they gave the example like this:
Imagine that Google Analytics provide some API services, and as the QC, you want to call these APIs to do testing, but you don't wan't to trigger to these services (it means the servers aren't affected like insert record, updates records or delete records) , what will you do?
My answer:
I will use "stub" or "mock" to fake the request, it will simulated the data that I want to GET , POST, PUT , DELETE.
Am I correct? Or we have anything else to do this? Any comment is welcome.

in progress 0
Manual 1 Answer 1779 views 2

Answer ( 1 )

  1. huydn234
    July 30, 2015 at 9:43 am

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    I think that the trigger to call services when testing Rest API is called or not depends on Server, not the way you call them. Why?
    Because the main characteristic of REST is to use URL as "route" to deal with data. Unless server doesn't deal anything with URL, just accept and log it for example, when you send a request to a RESTful URL, the server itself automatically receive and process it.
    And if the main reason for not calling services is make no change to database (insert/update/delete), and you have still to test the RESTful URL, you can use GET request only or send POST/PUT/DELETE with invalid data or Unauthorized requests to check the response.

Leave an answer

Phuoc Nguyen R

About [Phuoc Nguyen]