Detailed explanation of interface protocol, interface test, and commonly used interface test tools

1. Preface: What is an interface

1. Interface refers to a service provided by software to the outside world. The function is to make the internal data can be modified by the external interaction.

For example: USB interface, the data in the computer can be regarded as content data, and the data in the U disk can be regarded as external data, then the function of the USB interface is: the computer and the U disk exchange data, that is, make the data inside the computer Can exchange data with external U disk.

For example, the withdrawal and recharge of WeChat calls the interfaces open to the outside world of the bank. These interfaces have permission control and generally require an authentication code token to access. Then why do you need an authentication code? If there is no authentication code constraint, can anyone modify the data inside the bank? That's okay, then you can really set a small goal!

2. Generally speaking, there are two types of interfaces: one is the internal interface of the program, and the other is the external interface of the system.

The external interface of the system: For example, if you want to obtain resources or information from other websites or servers, others will definitely not share the data with you. He can only provide you with a method they have written to obtain the data, and you quote him to provide The interface written by him can use the method written by him to achieve the purpose of data sharing. For example, the app we use is called through the interface when processing data.

The interface inside the program: the interaction between methods, modules and modules, the interface thrown inside the program, such as the bbs system, there are login modules, posting modules, etc., then you must log in first if you want to post. You have to log in, then the two modules have to interact, and it will throw an interface for the internal system to call.

2. Interface protocol and corresponding interface testing tools

1. Interface based on http protocol:

The http protocol is also called the hypertext transfer protocol. It is mainly used for data exchange between the browser and the server. This interface often uses two methods of get and post to request. The interface developed based on this protocol is currently the most on the market! Commonly used interface testing tools are:

Postman

Jmeter

 

2. Interface based on webService protocol

webService is a communication protocol based on soap, and the request and return messages are generally in xml format. Commonly used interface testing tools are:

SoapUI

 

3. Interface based on Dubbo protocol

1. Dubbo’s default protocol adopts a single long connection and NIO asynchronous communication, which is suitable for small data volume and large concurrent service calls, and the situation where the number of service consumer machines is far greater than the number of service provider machines 2. It is not suitable for transmitting large data
volumes Services, such as file transfer, video transfer, etc., unless the request volume is very low.

3. Interfaces based on the Dubbo protocol are generally tested using the SoapUI tool.

3. How to design test cases for interface testing?

Interface testing generally considers changes in the form of input parameters and the business logic of the interface. Generally, the design of interface test cases adopts the equivalence class, boundary value, and scenario methods!

The idea of ​​interface test design test case is as follows:

1. Interface business logic test? (positive example)

Interface logic test refers to the output value obtained under normal input conditions according to the description of business logic, input parameters, and output value

Whether the test is correct, that is, to test whether the interface services provided to the outside world are working normally.

2. Module interface test? (counter example)

The module interface test is to ensure the safety of the data and the correctness of the logic of the program under abnormal conditions. ?

The module interface test mainly includes the following aspects?

1) The authentication code token is abnormal (the authentication code is empty <no authentication code>, wrong authentication code, expired authentication code).

2) Other parameters are abnormal.

 1. Check required items

2. The length, type, and format of the parameter are abnormal:

General parameters: (number, string, date)

Parameter length: 6-18 digits. Or ID card, phone length.

Parameter types: numbers (precision), letters, Chinese, parameters with spaces, special characters.

Date format: date: year, month, day, year, month, day, hour, minute, second, date format (including /,-,:, etc.).

3) Error code exception coverage.

4) Other concerns of interface testing

When the interface has page turning, the outlier test of page number and page number

Addition, deletion, modification and query of the database, for example, after a post interface operation is completed, check whether the new data is consistent with the previous post through the list page interface

Whether the URL of the picture returned by the interface can be opened, and whether the size of the picture meets the requirements

When the output parameters are linked, it is necessary to verify whether the actual results returned by the two parameters meet the requirements.

All list page interfaces must take sort values ​​into account

All functions should be considered compatible with the old version

4. Interface composition?

1. What are the components of the interface?

According to the interface document, the interface should at least consist of: request address, request method, request parameters (input parameters and output parameters), and some interfaces have request headers.

2. What is the difference between the header request header and the input parameters are sent to the server?

First of all, they are all parameters sent to the server, but they are different. The parameters stored in the header generally store some verification information, such as cookies, which are used to verify whether the request has permission to request the server. If so, it can request the server, and then send the request address together with the input parameters to the server, and then the server will return the output parameters according to the address and the input parameters. That is to say, the server first accepts the header information to determine whether the request has permission, and then accepts the request address and input parameters after judging that it has permission.

 V. Summary

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive  

Guess you like

Origin blog.csdn.net/okcross0/article/details/132340971