Sunday, 11 April 2021

How to create test cases for API Testing on GET/POST/PUT/PATCH/DELETE?




Status Codes in real-Time:

https://automationreinvented.blogspot.com/2019/03/what-are-most-used-api-status-codes.html


STATUS CODES TYPES:

1xx-Information

2xx-Success

3xx-Redirection

4xx- Client Error

5xx- Server Error

To know more about status codes check :https://httpstatuses.com/


Prac: https://reqres.in/

Target : GET - https://reqres.in/api/users?page=2

Test Cases on GET:

1. Scenario Related to Query param (create test data with both key(page) and value(2))

TEST API ENDPOINT: GET - https://reqres.in/api/users?page=2

        https://reqres.in/api/users?page=00002

https://reqres.in/api/users?page=teststring

https://reqres.in/api/users?page= 1

https://reqres.in/api/users?page=1.45666777

https://reqres.in/api/users?page=@#$%

https://reqres.in/api/users?test=1

https://reqres.in/api/users?page=2test

https://reqres.in/api/users?page=*2*

https://reqres.in/api/users?"page"=2

https://reqres.in/api/users?page=2//

https://reqres.in/api/users?page=2\\

https://reqres.in/api/users?page=//2//

2. Scenario related to server address

        http://reqres.qa/api/users?page=2

http://retest.in/api/users?page=2

3. Scenario related to end point

   https://reqres.in/test/users?page=//2//

   https://reqres.in/API/users?page=2 

   

4. Scenario related to Protocol

   http://reqres.in/api/users?page=2

   https://reqres.in/api/users?page=2

   Try to test with both https and http protocol   


Test Cases on POST:

Let you have a POST method with endpoint as:  https://reqres.in/api/register

and request body as below:

{

    "email": "eve.holt@reqres.in",

    "Password": "pistol"

}


Now lets create some of the test scenarios to check on Request Body format for the POST method:

1.Try with wrong password

  {

    "email": "eve.holt@reqres.in",

    "password": "tdstcwcdygwec544"

  }

O/P:200(coz its a prac api)

2.

{

    "EMAIL": "eve.holt@reqres.in",

    "password": "tdstcwcdygwec544"

}

O/P:400 status code

3.

{

    "email": "eve.holt@reqres.in"   

}

O/P: 400 status code

4. Try to change the domain

{

    "email": "eve.holt@reqres.com",

    "password": "tdstcwcdygwec544"

}

O/P: 400

5.

{

    "email": "eve.holtwww@reqres.in",

    "password": "tdstcwcdygwec544"

}

O/P: 400

6.TRy to change the key name from password to test

{

    "email": "eve.holt@reqres.in",

    "test": "pistol"

}

Status: 400

7.

{

    "username": "eve.holt@reqres.in",

    "password": "tdstcwcdygwec544"

  }

O/P:200


401 vs 403:

https://automationreinvented.blogspot.com/2020/09/difference-between-api-status-code-401.html

Check below link for question and answers with code:

Top API Interview Question 1-10

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions


No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...