Bamboo Wolf

Time:2020-5-19
  1. Why do interface tests

    In the daily development process, some people do the front-end development, and some people are responsible for the back-end development. The interface is to connect the front end and the back end. Because the speed of front-end development and back-end development may be different, for example, the back-end development is finished, but the front-end is not developed. So don’t we need to test? Generally, most of us do function tests, many of which are interface function tests. If you understand interface testing, you can test for interfaces
    在这里插入图片描述
    Take a look at the test pyramid. Interface testing is in the middle, unit testing is at the bottom, and interface testing is at the top. In terms of the size of the three areas, unit test and interface test are the key points, while interface test is really too few. This area, you can understand as code coverage, also can understand as the workload of testing. Here’s a point of view: now domestic companies pay more and more attention to interface testing. In the past few years, a lot of testing resources have been put on interface testing, and will gradually be put on interface testing function, performance, automation and stability testing in the future. At present, white box testing is still developing its own tests. Some large companies pay attention to the quality of software products, and also arrange some testers with code ability to assist and guide developers in unit testing to jointly ensure the quality of software.

2. What is interface test

Generally speaking, test interface refers to the function, performance and stability test of the test interface, and of course, the security test. This introduction series will let you master the function test of the interface. Generally speaking, the interface we heard about basically refers to the interface test of HTTP or HTTPS protocol, that is, some web service requests. In a software project, there are many interfaces, dozens of which are fewer, and hundreds of thousands of which are more. At this time, we have no software interface, no specific test scenario, only one interface description document. We need to test the interface through the theory and method of software testing to find out the function and security defects of the interface. The interface has internal interface and external interface. Internal interface is the interface developed by developers themselves. The external interface is like the website calling WeChat payment and Alipay payment interface. There are also interfaces between modules. People who have studied Java or used selenium should have an understanding of interfaces. Your automation script calls a lot of selenium interfaces.

3. Interface classification

Before starting interface testing, it is necessary to understand the classification of interfaces. The classification here is mainly HTTP request method classification. There are many classifications below. Our most common four methods are get / post / put / delete. The most common interfaces in our work are get and post methods.
在这里插入图片描述
4. Difference between get and post

This question is often mentioned in the interview. In short, we can go back to the difference from three aspects: way, size and security

1) . method

Method refers to the method of parameter passing in. Get method generally refers to obtaining the data on the server. Parameters follow the URL directly and can be placed in the browser address bar directly. For example, login uses get method. The post method refers to the client submits form data to the server, so post is submitted through the form, for example, the questionnaire and answer questions on your web page are post method.

2) . size

It has been known that get is entered directly in the address bar of the browser. Due to the limitation of the browser, the length of the whole URL can be very long, but it can’t exceed the size limitation of 2049kb, and this post has no size limitation.

3) . security

Because get parameters are directly spliced in the browser address bar and exposed to the Internet, it is certainly not safe. Post is submitted through form data, which is safer than get method.