Pages

Sunday, 29 May 2022

Top API Testing Interview Questions and Answers? Rest API testing interview questions with real time scenarios

 


API testing has been considered the future of software testing and it has advantages in the ability to test for Backend functionality, time effectiveness, language independence, and GUI integration. It becomes a must for software testing projects to ensure product quality and at the same time important part of Testing/SDET interview questions and asnwers. In below post we will check API Testing Interview Questions and Answers along with real time examples.


Content will be focused on below :
- REST API testing interview Questions
- Advanced API testing Interview Questions
- Rest Assured API Testing interview Questions for experienced

Explain what statelessness means in REST?

Ans: Statelessness means that the client and server don’t store information about each other’s state. Since the server stores no information, it treats each client request as a new request.

As a consequence, the following conditions would apply:

  • The client request contains all information required for the server to process the request
  • Client application is responsible for storing session state

 How to send Nested JSON object as payload?

Ans:
Ex: {“space”: {

“name”:”myspace”,

“id”:”sidharth″

}}

HashMap<String,Object> mainobj= new HashMap<String,Object>();

HashMap<String,String> subobj= new HashMap<String,String>();

subobj.put("name","QA");

subobj.put("id","sidharth");

mainobj.put("space",subobj);        

 

What is JSON Schema and how to perform Scheman Testing with Rest Assured?

Ans: Click Here For Answer With Code

What are the disadvantages of REST API?

Ans:

  • Doesn’t enforce security practices
  • HTTP method limits you to synchronous requests
  • Due to statelessness, you might be unable to maintain state (e.g. in sessions)

 

What is Input injection and what are different ways to simulate user input?

Ans::
Input Injection:  It is the act of simulating user input, in several ways you can simulate user input.

  • Direct Method Invocation
  • Invocation using an accessibility interface
  • Simulation using low-level input
  • Simulation using a device driver
  • Simulation using a robot

    What are some architectural styles for creating a Web API?

Ans::This is one of the fundamental Web API interview questions. Bellows are four common Web API architectural styles:

  • HTTP for client-server communication
  • XML/JSON as formatting language
  • Simple URI as the address for the services
  • Stateless communication

            

  • Explain some API defects that you have found in your recent project?

Ans: Click Here For Answer

Which purpose does the OPTIONS method serve for the RESTful Web services?

AnsThe OPTIONS Method lists down all the operations of a web service supports. It creates read-only requests to the server.

SDET Interview Question and Answers     TestNG Interview questions and answers

Jenkins Interview Questions and Answers.  
Appium Interview Questions and Answers


What is the major drawback of using SOAP?

AnsWhen using SOAP, users often get the firewall security mechanism as the biggest obstacle. This block all the ports leaving few like HTTP port 80 and the HTTP port used by SOAP that bypasses the firewall. The technical complaint against SOAP is that it mixes the specification for message transport with the specification for message structure.

What is the difference between 401 and 403?

Ans:  Click Here To Find Diff Between 401 & 403


When to use contract testing?

AnsContract testing is immediately applicable anywhere where you have two services that you need to communicate - such as an API client and a web front-end. Although a single client and a single service is a common use case, contract testing really shines in an environment with many services (as is common for a microservice architecture). Having well-formed contract tests makes it easy for developers to avoid version hell. Contract testing is a killer app for microservice development and deployment.


To learn more about the use of the pact in contract testing please refer: ContractTestingWithPact
What are the status codes you have come across in your API testing project?

Ans: Click Here For Status Codes

How to fix the error import io.restassured.RestAssured cannot be resolved?


Do you have the scope set to test when you are adding the mentioned dependencies? This limits the code from accessing that dependency's classes within the source code. That is, we can access those classes within your testsources (ex: ${project.dir}/src/test/java/<package>${project.dir}/test/<package>.


If that is not your intended use case, just remove the scope attribute.

  <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>4.1.1</version>
  </dependency>

How to use mocking and create Stub with Wiremock for your integration tests?


Ans:Click Here For Answer With Code And Steps

74. How to check API responses in mobile (Android/IOS) browser?

Ans: Using Fiddler or Charles Proxy. A proxy server is an intermediary for requests which travel from client to server and vice-versa.
A proxy can exist on the same machine as the client or server, it can also exist on a separate machine. This is the case for the setup we are going to use in the current context where we will have a client (mobile phone with an application we want to debug), a proxy server (our PC ) and a Server (which communicates with the client).



75. Explain the Authorization in API?

Ans:  Click Here For All API Auth

76. How to do Load Testing with Postman?

Ans: 
Step 1- Click on the arrow along with your collection in the collection listing

Step 2- Then click on the Run button to launch Collection runner

Collection runner is the part which is used for Load testing


Step 3- Collection runner has a lot of important parts to consider for load testing like Iterations, Delay as shown in below screenshot.



77. What is the difference between 401 and 403?

Ans:  Click Here For Differences between 401 & 403




*******************************************************************
For any doubts or career guidance, arrange a 1:1 call with me 


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

Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

TRANING VIDEOS AVAILABLE with Live Doubt Session @4500/-(course-1 below,API TRaining Videos With ClassNotes and Coding Set) and 6500/- (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122

Entire course content can be found below:  COURSE CONTENT


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

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

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
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python

Thursday, 19 May 2022

Top 33 Python Interview questions and Answers for SDET - QAE - SDE? Python Interview Questions on List

 



Python Interview Question & Answers Set - 01

Python Interview Q&A Set- 02

Automation Testing/SDET Framework Design Link

Java Related Interview Question Set LINK

GIT Interview Question Set LINK


If you are new to PYTHON then first check the post on How to Install Python on windows and mac?, once installation is complete then only checkout the below Q&A


How to take screenshot of the current window using Selenium-Python ?

Use the save_screenshot method provided by the webdriver:

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://automationreinvented.blogspot.com/')
driver.save_screenshot('screenshot.png')
driver.quit()

If you are preparing for Selenium-Python Interview then also check below Q&A:


Python Interview Question & Answers Set - 01

Python Interview Q&A Set - 02

Python Interview Q&A Set - 03


23. What is Python Lists and give an example?

Python Lists are sequential data types, enclosed with square brackets([]) and elements are separated by comma(,).

Python Lists are mutable i.e. we can change any element(s) of lists if we want to change.

  # defining a list

testList = [1, 2, 3, 4, "Test", "Automation"]


24. How python list slicing works, try to solve below?


print only "test" "automation" from list = [1, 2, 3, 4, "Test", "Automation"]



List slicing: type the range of indexes to get the elements inside that range.


to print only test and automation we need to use :


print(list[4:5])


25. How to check if list contains an element?


Ans: we can use "in", for example:


list1 = [1,2,3,'test','automation']

'test' in list1


o/p True


26.What are the python frameworks you have used for Test Automation?


Ans:
 Click Here For Answer


27. What is the difference between append and extend?


.append() adds an object to the end of a list.

This also means appending a list adds that whole list as a single element, rather than appending each of its values.

a.append([7,8])

a #=> [3, 4, 5, 6, [7, 8]]

.extend() adds each value from a 2nd list as its own element. So extending a list with another list combines their values.

b = [1,2,3]

b.extend([4,5])

b #=> [1, 2, 3, 4, 5]


28. How to convert TuplesStringsSets to List?


Ans: we can use the list() method, it can convert any sequence datatype into lists.


Tuple = (1, 2, 3, 4)

List1 = list(myTuple)

String = “Automation”

List2 = list(myString)

Set = {1, 2, 3, 4}

List3 = list(Set)


29. What is the difference between “remove” and “pop”?


Ans: 

.remove() removes the first instance of a matching object. 

a = [ 'b', 'b', 'c', 'c']

a.remove('b')

O/p:  ['b', 'c', 'c']  //it has removed the first instance of b


.pop() removes an object by its index.

The difference between pop and del is that pop returns the popped element. This allows using a list like a stack.

a = [’t’, ’t’, ‘r’, ‘r’, 'c', 'c']

a.pop(4)

O/p: [’t’, ’t’, ‘r’, ‘r’, 'c'] //removed the 4th element that is c as index starts from 0

By default, pop removes the last element from a list if an index isn’t specified.


30. How to remove duplicate elements of list?


Ans: The east approach is converting to a set and back to a list, but it wont maintain the order.


list = [5, 6, 6, 1, 1]

list(set(list)) 

O/P=> [1, 5, 6]


BonusWhat are the different environment variables in Python?


31. How to count the occurrence of a specific object in a list?

Ans: 

The count() method returns the number of occurrences of a specific object. Below we return the number of times the string, “test” exists in a list .

list = [‘test’,’test’,’automation’,’reinvented’,’selenium’]

list.count(‘test’)

O/P:  2


32What are the rules of variable naming in python?

Ans: Click Here For All The Rules


33 What are the built-in List methods/functions provided by Python?


Method

Use

len()

returns list length

sort()

sorts the list

min()

returns the minimum value from list

max()

returns the maximum value from list

list()

converts a sequential data type to list

append()

adds an element at the end of the list

clear()

removes all elements from the list

copy()

returns the copied list

reverse()

reverses the order of the elements of the list

sum()

returns the sum of the elements of the list

range()

returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number

pop()

removes the element at the specified position

remove()

removes the item with the specified value

index()

returns the index of the first element with the specified value

insert()

Adds an element at the specified position



Details of all Python Methods: Click Here For Details



REVISION:

19Correct the below string:

print(“He is "A" genius”)


Ans: This will give syntax error, If we use backslash “\” followed by the character like ” then the problem will get resolved.


print(“He is \"A\" genius”)


20. How to replace Genius with fool in below string?
 Str = "He is a genius"


Ans: print(Str.replace("genius","fool")

8. How to convert an integer to string in python ? How to perform typecasting?


Ans:
var = 23

varString = str(var). //convert the int datatype to string


9. What is complex datatype in Python?


Ans: Click Here For Answer


10. Let we have below string, we want to print only Automation


x = "TestAutomation"


Ans: print(mystr[4:len(mystr)])


Python Interview Question & Answers Set - 01

Python Interview Q&A Set- 02


*******************************************************************
For any doubts or career guidance, arrange a 1:1 call with me 


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

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
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing
Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python