I. Preface: What is interface

1. Interface refers to a service provided by software to the outside world. An interaction whose function is to enable internal data to be modified externally.

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, so the role of USB interface is: computer and U disk interaction data, that is, to enable the data inside the computer to exchange data with the external U disk.

For example, wechat withdrawal and recharge will call the bank’s open interface, which has permission control and generally requires authentication code token to access. So why an authentication code? If there is no authentication code constraint, can anyone modify the data inside the bank? That’s okay. That’s a real small goal!

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

External system interfaces: For example, if you want to obtain resources or information from other websites or servers, others will not share data with you. They can only provide you with a method written by them to obtain data. You can use the method written by them by quoting the interface provided by them, so as to achieve the purpose of data sharing. For example, the APP we use is called through the interface during data processing.

Within the program interface: between the approach and method, the interaction between the module and module, thrown within the program interface, such as BBS system, has the login module, Posting module, etc., that you want to post you must login first, Posting must login, then the two modules have to have interaction, it throws an interface, the calling for internal system.

Two, the interface protocol and the corresponding interface testing tool

1. HTTP based interface:

HTTP protocol is also called hypertext transfer protocol, is mainly used for browser and server interaction data, this interface often use get and POST two methods request, based on this protocol development interface is the most on the market at present! Commonly used interface testing tools are:

Postman

Jmeter

2. Interface based on webService protocol

WebService is a soap-based communication protocol. The request and return packets are generally in XML format. Commonly used interface testing tools are:

SoapUI

3. Interface based on Dubbo protocol

1. The default duBBO protocol adopts a single long connection and NIO asynchronous communication, which is suitable for service invocation with small data volume and large concurrency, and the number of service consumer machines is far greater than that of service provider machines

2. Not suitable for services that transmit large amounts of data, such as files and videos, unless the request volume is very low.

3. Dubbo protocol-based interfaces are also tested using SoapUI tools.

How to design test cases for interface test?

Interface testing generally considers the changes in the form of parameters and the business logic of the interface, the general design of interface test cases using equivalence classes, boundary values, scene method in the majority!

The thinking of interface test design test case is as follows:

1. Interface business logic test? (is)

Interface logic test refers to the description of the service logic, input parameters, and output values to obtain the output values under normal input conditions

Whether the test is correct, that is, to test whether the external interface services work properly.

2. Module interface test? (DE)

Module interface test is to ensure the security of data and the correctness of program logic in abnormal cases. ?

Module interface test mainly includes the following aspects?

A. The authentication code token is abnormal (the authentication code is empty < no authentication code >, incorrect authentication code, or expired authentication code).

B. Other parameters are abnormal.

1. Mandatory check

2, the length, type, format of the parameter is abnormal:

General arguments :(number, string, date)

Parameter Length: 6 to 18 characters. Or id card, telephone length.

Parameter types: digits (precision), letters, Chinese characters, parameters with Spaces, and special characters.

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

A. Error code exception coverage.

B. Interface test other concerns

Page number and page number outlier test when the interface has page-turning

Add, delete, change and check 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 image address returned by the interface can be opened and whether the image size meets requirements

When the output parameters have linkage, it is necessary to verify whether the actual results of the two parameters meet the requirements.

All list page interfaces must consider sorting values

All functions should be considered compatible with older versions

4. Interface composition?

1. What are the components of an interface?

According to the interface document, the interface should at least be composed of the request address, request method, request parameters (input and output parameters), and some interfaces have request header.

Header and input parameters are sent to the server. What’s the difference between them?

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.

Five, the summary

There is no winter that will not pass, no spring that will not come. The year 2020 is an extraordinary year for the whole world. In 2021, let’s get ready to go, start from the heart, and come on.