One . What is an interface
Interface is internal module to module , A standard for the ability of external systems to call or connect to other services , like usb Interface , It is an interface provided by the system for physical data transmission , Of course, only one interface cannot be transmitted , We also set and define how to transmit this interface . Developing the so-called interface is a connection between modules , The interface in the eyes of test is a protocol ( A definition of the function of an interface )
Two 、 How to test the interface
1. Using tools for interface testing
Such as : apipost、 jmeter And other tools for interface testing .apipost This kind of The interface test Tools , Mainly for interface verification and interface document generation .apipost This interface testing tool , Is a very lightweight interface verification tool , You can enter the request method 、url、 Parameters directly access the interface request , Verify whether the interface is open , You can also check the returned response value to see if the interface development is normal . Based on these interface validation information , It can generate online documents and offline versions directly word file . Is a great interface testing and interface document generation tool , It's not like that swagger The generated interface documents are all in English, which is not very convenient to read .apipost And have the ability to work together , Can be very effective implementation of the front-end interface debugging .
jmeter Interface testing and performance testing can be done , But for simple interface testing jmeter It doesn't work apipost Easy to use .jmeter The point is stress testing , Stability testing and load testing . Aiming at the stability of the interface and program, an interface testing tool is designed with software performance as the main function and interface test as the auxiliary .
2. Script for interface testing
Commonly used python+requests Conduct interface test . The principle of implementing interfaces is the same as that of interface testing tools . Or through url、 Parameter and request method . call requests and json, Because parameters are generally passed through json Format transfer .
These are the two main implementation methods of interface testing , Tools are much simpler to use than interface testing through scripts . It is recommended that all beginners of interface testing use apipost And other test tools for interface testing .
Tool download address : Apipost- Based on collaboration , More than API file 、 debugging 、Mock
Link to the original text : http://t.csdn.cn/ZLBnf-