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.
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.