Detailed interface test, interface protocol and common interface test tools

1. Preface: What is an interface

1. The interface refers to a service provided by the software to the outside world. The role is to make the internal data can be modified by the external interactive way.

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 role of the USB interface is: the computer and the U disk interact data, that is, the internal data Able to exchange data with external U disk.

For example: WeChat withdrawals and recharges call the bank's open interfaces. These interfaces have permission control, and generally require an authentication code token to access. Why do you need an authentication code? If there is no authentication code, can anyone modify the internal data of the bank? That's fine, then you can really set a small goal!

2. Generally speaking, there are two kinds 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 certainly not share the data with you. He can only provide you with a method they have written to obtain the data. You quote him to provide You can use the method he wrote to achieve the purpose of data sharing. For example, the app we use is called through the interface when data processing.

Interfaces inside the program: methods and methods, module-to-module interaction, interfaces thrown inside the program, such as the bbs system, there are login modules, posting modules, etc., then you must log in before posting You have to log in, then the two modules have to interact, and it will throw an interface for the internal system to call.

Second, the interface protocol and the corresponding interface test tool

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 is often requested using two methods of get and post. 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. The request and return messages are generally in xml format. Commonly used interface testing tools are:

SOAP

3. Interface based on Dubbo protocol

1. Dubbo's default protocol uses a single long connection and NIO asynchronous communication, which is suitable for service calls with small data and large concurrent, and the number of service consumer machines is much larger than the number of service provider machines
. Services, such as transferring files and videos, unless the request volume is low.

3. The interface based on Dubbo protocol is generally tested using SoapUI tool.

3. How to design test cases for interface testing?

Interface testing generally considers the change of input parameters and the business logic of the interface. Generally, interface test cases are designed to use equivalence classes, boundary values, and scene methods!

Interface test design test case ideas are as follows:
1. Interface business logic test? (Positive example)
      Interface logic test refers to
      the test of whether the output value obtained under normal input is correct according to the description of business logic, input parameters, and output values , That is, to test whether the interface services provided to the outside work normally.
2. Module interface test? (Counterexample) The
      module interface test is a test conducted to ensure the security of data and the correctness of the logic of the program under abnormal conditions. The
      module interface test mainly includes the following aspects:


      1) abnormal token authentication code (authentication code empty <no authentication code>, error code authentication, the authentication code expired).
      2) Other parameters are abnormal.
          1. Mandatory item check
          2. Abnormal length, type and format of the
                parameter : conventional parameters: (number, character string, date)
                Parameter length: 6-18 digits Or the length of the ID card and phone.
                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) The error code is overwritten abnormally.
      4) Interface test When other
          pages of concern interface turn pages, the outliers of page numbers and page numbers test
          the addition, deletion and modification of the database. For example, after a post interface operation is completed, check whether the new data and the previous post are through the list page interface
          Whether the picture address returned by the consistent interface can be opened, and whether the picture size meets the requirements.
          When the output parameters are linked, it is necessary to verify whether the actual results of the returned two parameters meet the requirements.
          All list page interfaces must consider sorting values ​​and
          all functions must be compatible with older versions

Fourth, the interface composition?

1. What are the components of the interface?

According to the interface documentation, the interface should have at least: request address, request method, request parameters (input 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 indeed the parameters sent to the server, but they are different. The parameters stored in the header generally store some verification information, such as cookies, which is used to verify whether this request has permission to request the server. If it does, it can request the server, and then send the requested address to the server along with the input parameters, and then the server will return the output parameters based on the address and the input parameters. In other words, the server first accepts the header information to determine whether the request has a permission request, and only after determining the permission, will the request address and input parameters be accepted.

V. Summary

If you think this article is helpful to you, if you have any questions about this article, if you are interested in software testing, interface testing, automated testing, interview experience exchange, please join:

Software testing technology group: 695458161, the free materials distributed in the group are the essence of the author's more than ten years of testing career. There are also peers to exchange technology together.

Author: Zhuge
Source: https: //www.cnblogs.com/csmashang/p/12741059.html
original is not easy, welcome to reprint, but without the author's consent Keep declared by this section, given the original article page link in the apparent position.

Guess you like

Origin www.cnblogs.com/csmashang/p/12741059.html