API Testing Flashcards

1
Q

What is an API?

A

An API, or Application Programming Interface, enables communication and data exchange between two separate software systems.

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

How does API Testing work?

A

API Testing is testing the Application Programming Interface of any application. It is used to determine whether APIs return the correct response. It is consider a part of Integration Testing, and commonly includes testing REST APIs or SOAP web services with JSON or XML message payloads.

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

Why API Testing?

A

Earlier Testing - Once the logic is implemented, tests can be built to validate the correctness in responses and data. No need to wait for the front-end to be built.
Easier Test Maintenance - UIs constantly change and are accessed from different browsers, devices, and screen orientation. This makes using the UI to test relatively unstable, whereas API has no such challenges.
Faster Time To Resolution - When API tests fail, we know exactly where our system broke and where the defect can be found. This allows us to quickly fix the bug.
Speed and Coverage of Testing - 300 UI tests may take 30 hours, whereas 300 API tests could be run in 3 minutes. In short, you’ll find more bugs in less time.

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

What two things to APIs need?

A

APIs need a medium (ex: HTTP) and a format (JSON, XML). All web services are APIs, but not all APIs are web services.

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

What is REST?

A

REST is an acronym for Representational State Transfer —REST is a way for two computer systems to communicate over HTTP in a similar way to web browsers and servers. REST is an architectural style which permits various data formats such as Plain Text, HTML, XML, and most commonly JSON.

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

What are the REST API Methods? (HTTP)

A

POST - Create a REST API resource.
GET - Retrieve information about the REST API resource.
PUT - Update (Replace) a REST API resource.
PATCH - Update (Modify) a REST API resource.
DELETE - Delete a REST API resource or related component.

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

What are 2 recommendations and constraints for RESTful web services?

A

Client-Server: SystemA makes an HTTP request to a URL hosted by SystemB, which returns a response, similar to how a browser works. The application makes a request for a specific URL, and the request is then routed to a web server that returns an HTML page.
Stateless: REST is stateless, the client request should contain all the information necessary to respond to a request. In other words, it should be possible to make two or more HTTP requests in any order and the same responses will be received.

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

What are the HTTP response status codes?

A

HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:

    Informational responses (100–199)
    Successful responses (200–299)
    Redirection messages (300–399)
    Client error responses (400–499)
    Server error responses (500–599)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does API documentation consist of?

A

An API Documentation will consists of all the developed endpoints information. It should have request method, request body, request headers, request parameters, expected response status code and response body.

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

What’s the purpose of creating mock REST APIs?

A

Sometimes we face a situations when there are no API endpoints is available to perform testing. In those situations we can easily develop fake REST API endpoints to perform our testing. And once the actual endpoints is being developed then we can replace the fake REST API with the real one.

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

What is the JSON Server?

A

JSON Server the JavaScript json-server library, which can be used to create fake REST API.

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