Postman, Jmeter, who does automated testing, I think I’m familiar with those two words. Postman is known for its convenience in interface testing. Here are some examples of how it can be used:

First, let’s introduce the concept of interface testing:

1. What is interface testing?

Interface test is a test to test the indirect interface of a system component. Interface testing is mainly used to detect the interaction points between external systems and internal subsystems. The focus of the test is to check the data exchange, transfer and control management process, as well as the logical interdependence between systems.

2. Interface composition

What are the components of an interface? First, the interface document should contain the following contents: 1. Interface description 2. Call URL 3. Request method (GET \ POST) 4

According to the interface document, the interface should at least be composed of request address, request method, request parameters (input and output parameters), and some interfaces have request header. Header: a string sent by the server before sending HTML data to the browser using HTTP. A blank line is required to separate the header from the HTML file and store information such as cookies and tokens. Aren’t they all parameters sent to the server? OK, first of all, they are sent to the server in the argument, but there is a difference between them, and store the parameters of the general store in the header is some validation information, such as cookies, it is to check if the request have permission request to the server, if you have, it can request to the server, and then send the request address along with the participation to the server, The server then returns the outgoing parameter based on the address and incoming parameter. In other words, the server accepts the header information to determine whether the request has permission, and then accepts the address and entry parameters.

3. Why do interface tests?

A) Nowadays, with the increasing system complexity, the cost of traditional testing methods increases sharply and the test efficiency drops sharply. Interface testing can provide a solution to this situation. B) Interface test is relatively easy to realize automatic continuous integration, and relatively stable compared with UI automation, which can reduce the labor cost and time of manual regression test, shorten the test cycle, and support the demand of back-end rapid release. Continuous interface integration is the source of low cost and high benefit. C) At present, many systems are separated from the front and back end architectures. From the perspective of security: 1) Only relying on the front end to limit has completely failed to meet the security requirements of the system (it is too easy to bypass the front), and the back end also needs to control, in this case, it needs to verify from the interface level. 2) Whether the information transmitted at the front and back ends, log printing and other information is encrypted transmission also needs to be verified, especially related to the user’s privacy information, such as ID card, bank card, etc.

4. Interface testing tools

There are many tools for interface testing, such as Postman, RESTClient, Jmeter, LoadRunner, SoapUI, etc. My first test tools are Postman and JMeter. Next, I will briefly introduce how to use these two tools for interface testing. 1) Postman is a Google interface test plug-in, it is simple to use, support use case management, support get, POST, file upload, response verification, variable management, environmental parameter management and other functions, can run in batches, and support use case export, import. Jmeter is a free and open source tool written in 100% pure Java. It is mainly used for performance testing. Compared with LoadRunner, it has a small memory footprint, is free and open source, lightweight and convenient, and requires no installation. Note: the address used in the following cases is my local environment, external network can not access, sorry. (1), GET the user information: the interface is used for user information obtained through userid request address: http://192.168.1.102:8081/getuser request: POST/GET into arguments:

Reference:

Postman request: jmeter request: You need to add the header, the content-type application/json request address http://192.168.1.102:8081/getuser2 1.2 1.1 way get/post 1.3 into the refs

1.4 the reference

The postman test is as follows, this time the input parameter is json, of course, the document does not say that must use JSON, other ways can also be tested as follows Need to add the cookie, token token is written death way of token12345 request address http://192.168.1.102:8081/setmoney2 1.3 1.2 Post 1.4 into the refs

1.5 the reference

The postman test is as follows: Jmeter test is as follows: ④ File upload postman: jmeter: ⑤. Request webService Interface SoapUI is used to request the webService interface.

Conclusion:

Check out the Python automation test exchange group, which has organized a lot of learning materials for us, including automation, interface, performance and so on! Life is a process of rowing upstream, not to advance is to retreat, let’s refuel together! If you don’t understand something, you can ask the elder brother or discuss it in the group.