Why use an API test if I can get the same information from the website?



  • Why should I check the server response by using a GET call through an API if I already have a button on the site with the functionality to call the same method?



  • So you know where any problems originate

    If you have an API that's retrieving information and a website that displays it, you test the API to make sure that the correct information is retrieved. Then you test the website to make sure the information is displayed properly.

    Say you're looking for products in a category. Let's say the category is "hair care products", and you'd expect to see shampoo, conditioner, hair ties, hair clips, and the like. If you test the web site, and get pet shampoo, carpet shampoo, or car shampoo in the list of products that comes back, you don't know whether the problem is with the website asking for "shampoo" rather than "hair care products" or with the API (or with the database). You have to check what exactly was requested and then trace the API response to the request before you can work out what was wrong.

    If you started with the API request and got the products you expected, then you'd know as soon as you performed the web test that the problem was with the website. If you started with the API request and didn't get the products you expected, then you'd know the problem was with the product categorization or the API. You could make a call to retrieve all products and check their categories to determine the source of the problem.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2