API Testing Flashcards

1
Q

Tell A Story. How did you test APIs?

A
  1. Receive documentation from developers via Swagger. I need to know the endpoints, headers, payload keys, and format to send and receive the data
  2. From the documentation, I begin working on the checklist and make sure I ask developers about any missing requirements (if there are any)
  3. I create test cases
  4. I execute the test cases in the correct QA (development/staging) environment using Postman and save them into a proper collection so I can reuse them. I verfiy that API behaves as described in Swagger documentation and returns correct status codes and data.
  5. I report any bugs.
  6. I will created a test cases execution report.
  7. I also followed up on the bugs to make sure they have been fixed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an API?

A

Application Programming Interface. It is a set of routines, protocols, and tools for building software applications.

It specifies how one software program should interact with another software program.

API acts as an interface between two software applications and allows the two software applications to communicate with each other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is API Testing?

A

API testing is a type of software testing that involves testing APIs directly also as a part of integration testing to check whether the API meets expectations in terms of functionality, reliability, performance, and security of an application.
API testing focuses on the business logic layer of the software architecture.
API testing can be performed on any software system which contains multiple APIs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What tools did you use for API testing?

A

Postman

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Who can use a Web API?

A

Web API can be used by any clients which support HTTP verbs such as GET, PUT, DELETE, POST

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are advantages of API Testing

A
  • Time effective compared to UI testing
  • We can find minor bugs before UI testing. These minor bugs become bigger during UI testing. Therefore, it saves time and it’s cost effective.
  • Helpful in testing core functionality. We can test APIs without a UI and so we don’t need to wait for the application to be available to test the core functionalities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What exactly needs to be verified in API Testing?

A

With API testing, we send a request to the API with the known data and we analyze the response

  1. Data accuracy
  2. HTTP status codes
  3. Response times
  4. Error codes in case API returns any errors
  5. Authorization checks
  6. Non-functional testing such as performance and security testing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between API testing and Unit testing?

A

Unit:

  • conducted by dev. team
  • form of white box testing
  • conducted prior to the process of including the code in the build
  • source code is involved in unit testing
  • scope of testing is limited, so only basic functionalities are considered

API:

  • conducted by QA team
  • form of black box[grey box] testing
  • conducted after the build is ready for testing
  • source code is not involved
  • scope of testing is wide, so all issues that are functional are considered for testing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are some challenges faced in API testing?

A
  • Selecting proper parameters and its combinations
  • Categorizing the parameters properly
  • Proper call sequencing is required as this may lead to inadequate coverage in testing
  • Verifying and validating the output
  • Due to the absence of GUI, it is quite difficult to provide input values
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the types of bugs we face when performing API testing?

A
  • Stress, performance, and security
  • Duplicate or missing functionality
  • Reliability issues
  • Improper messaging and errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is UI testing incorrect error handling not similar to API testing?

A

UI testing is testing the graphical interface part of the application. Its main focus is to test the look and feel of an application. On the other hang, API testing enables communication between two different software systems. Its main focus is in the business layer of the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Name commonly used HTTP methods.

A

GET: enables you to retrieve data from a server
POST: enables you to add data to an existing file or resource in a server
PUT: lets you replace an existing file or resource in a server
DELETE: lets you delete data from a server
PATCH: used to apply partial modifications to a resource
OPTIONS: used to describe communication options for the target resource
HEAD: asks for a response identical to that of a GET request, but without the response body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Can you use GET request instead of PUT to create a resource?

A

No. GET requests only allows read-only rights. It enables you to retrieve data from a server but does not create a resource. PUT or POST methods should be used to create a resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the difference between PUT and POST methods?

A

POST - create a new object on the server
PUT - replace an object by another object

POST should be used when the client sends the page to the server then the server lets the client know where it put it.
PUT should be used when the client specifies the location of the page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is REST API?

A

Representational State Transfer. It is a set of functions helping developers perform requests and receiving responses. Interaction is made through HTTP Protocol in REST API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly