HTTP is an information transfer protocol in a form of HTML hypertext.
The protocol is a type of client-server communication in a form of request-response, within a network while working with API.
HTTPS is an extension of the above-mentioned protocol that helps to support encrypting and improving a security level.
API (Application Programming Interface) is an interconnection of two systems.
API helps to send data from one program to another, avoiding the user communication interface.
In the interface, while it is being launched, internal functions work to transfer and receive data.
API functionality is accepting a request and transferring data to a system, processing and returning a response.
[highlight dark=”no”]API structure should meet the standards[/highlight] — only in this case, there will be an interconnection between programs.
REST (REpresentational State Transfer) serves as an example of one standard of constructing mutual actions of applications and websites while using the HTTP protocol.
REST is a type of communication between a client and a server. The client (REST) sends a request and a server responds to it.
Common methods to send a request and receive a response
A request should contain:
- A selected action that needs to be executed;
- A possibility to write a title to transfer request’s data with the help of the client;
- A path;
- A message with data.
REST architecture is used while working with API and contains its own methodology: GET (giving information from a server about receiving), PUT (updating an abject or resource, etc.), POST (creation of an object or resource), DELETE (deleting a certain object or resource).
API testing entails correct work of functionality, security of programming interfaces, and so on.
You should use special tools while testing.
Using Postman to test requests
Postman is the HTTP client for testing API (https://www.postman.com/)
Postman helps to test:
- The creation of the HTTP request (by a client);
- A possibility to send a request to API HTTP (by a client);
- The creation of a collection where requests are located in folders (the collection is a project file with requests);
- Changing request’s data;
- Changing an environment of repeating requests;
- Using Collection Runner while performing automated API testing from the collection and grouped request folders. Collection Runner is a Postman tool that helps to implement all requests simultaneously. It shows a report when requests are sent.
Postman supports testing requests with any method mentioned above.
Testing is performed in order to send a request and receive a response in a form of the HTTP status code that tells about the correct work of API.
An order of creating requests:
- Click on “New” and “HTTP Request”;
- Creating a Postman collection, grouping requests into folders;
- Creating a request by clicking on “Add requests”.
Examples of testing (GET);
- Request user data;
- Write the API name;
- Select the “Raw” button in the “Body” tab;
- Click on the “Send” button in a form of JSON;
- The result is displaying user data. A possibility to compare the actual result with the expected one.
Conclusion
This type of testing helps to look at system behavior towards a real user and this has a big effect on improving the quality of a product-in-test while providing first-class independent testing services.
0 Comments