Pages

Thursday, 25 March 2021

Top 40 API Automation testing interview question for SDET and Automation QA ?

 

 

This is the fourth Set of API Testing Interview Question, for Set-01, 02 &03 refer below links.
 
Check below link for question and answers with code:

Top API Interview Question 1-10

 

 

31. How to create POJO for Request body?

Request Body:

{
    "name": "autouser",
    "job": "tester"
}

Ans: Click link here for the code on Pojo Class creation

32. How to use pojo class and pass value as Request Body in Rest Assured automation script on    POST method? Let assume request body is similar to previous question?


Ans: First Create a pojo class as mentioned in the previous question(Question number 31). As the pojo class name is "pojoClas" so now lets create object of our pojo class :
 

pojoClas obj = new pojoClas("automation","tester");

Now pass this object in body :


Response resp = given().headers("Content-Type","application/json").
                body(obj).
                when().post(baseurl + "api/users");

33. If the request body for POST method is missing some mandatory field then what will be the status code?

Ans: 400 bad request because when we send a post request all the mandatory field need to be present in request body.

34. How to run Rest Assured automation Suite from Jenkins CI-CD ? 

 Ans: Click here to Integrate CI-CD with Jenkins and API Automation Suite

35. Assume that you have response body as below, if you want to fetch all the key and value of id=2 then what method you will use?

data": [
        {
            "id": 1,
            "email": "michael.lawson@reqres.in",
            "first_name": "Michael",
            "last_name": "Lawson",
            "avatar": "https://reqres.in/img/faces/7-image.jpg"
        },
        {
            "id": 2,
            "email": "lindsay.ferguson@reqres.in",
            "first_name": "Lindsay",
            "last_name": "Ferguson",
            "avatar": "https://reqres.in/img/faces/8-image.jpg"
        },

Ans: Map<String, String> dataEmp = resp.jsonPath().getMap("data[1]");

36. How to Create Fake-API which can be used for Testing in Postman or Rest Assured? Very Useful for real-time practice

 Ans: Steps with Screenshot to Create API from Scratch - Click Here

37. What are REstful Webservices?

Ans:Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. 

So webservice which implements REST architectural style is called as Restful Webservices. For more info refer: https://docs.oracle.com/javaee/6/tutorial/doc/gijqy.html

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

How to run selenium tests from Jenkins? Maven and Jenkins Integration with Testng-Selenium?Run selenium maven project from command line?

Click Here For Steps with Screenshot

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

38. What are the types of API Authenticationmethods and how can automate the same using Rest Assured?

Ans: Click here for API Authentication methods Automation Script with Rest Assured.

39. "Restful webservices are fast", This statement is true or false and why?

  • RESTful Web Services are fast because there is no strict specification like we have in SOAP. It consumes less bandwidth and resource.
  •  It's also easier to integrate with existing websites with no need to refactor site infrastructure.
  • REST provides superior performance also, particularly through caching for information

40.What are the data formats supported by Rest API?

Ans: The currently-available response formats for all REST endpoints are string-based formats and include XML, JSON, PJSON, and HTML.

41. What is API Documentation?

API documentation is a technical content deliverable, containing instructions about how to effectively use and integrate with an API.

One of the most used API documentation tool is Swagger. To learn more about it, refer below link:

https://swagger.io/resources/ebooks/api-documentation-the-secret-to-a-great-api-developer-experience/



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