当前位置:网站首页>How to do interface testing? After reading this article, it will be clear
How to do interface testing? After reading this article, it will be clear
2022-07-02 19:57:00 【Xiaowu knock code】
01、 Common project architecture 
02、 What is an interface
Interface : A unified access method provided by the server program , Usually used HTTP agreement , Through different url, Different request types (GET、POST), Different parameters , To execute different business logic .
Most of the business operations of the client , All need to call the server interface to obtain some data , Or trigger some business , Then the client gets the data returned by the interface , It will do different processing and display according to the data content .
03、 Why do interface tests
A、 In the company , The client and server are usually developed by different teams , In the process of project development , The progress of client and server development is inconsistent , For example, the server is developed first , At this time, you can test the interface of the server first , Ensure that the server logic and return The back data is correct , Then test the client . Or some testing department , Dedicated test server development team , therefore , Their test object is the interface .
B、 When testing certain businesses , You can't just test through the front end , For example, user registration , The front end restricts that the user name cannot be empty , But some people may use tools to bypass the front end and call the server interface directly , If the server does not make relevant logical judgment , Will cause data error . Including whether key information is encrypted during interface data transmission . Therefore, the server interface must be tested separately .
C、 After development and test , You can run the interface test of the server through the tool first , Ensure that all interface test cases pass , Quickly judge whether the server interface meets the expectations . And then through UI Test the interface . Otherwise, the interface has bug, The front page must have bug.
04、 Interface test tools and processes
common HTTP Interface testing tools include Jmeter、Postman、SoupUI etc. . What is used more in enterprises Jmeter.
Jmeter It's an open source 、 Free interface testing tools , It can control the function of the interface 、 Performance testing . Interface automation can also be realized .
Jmeter Specific use , Please refer to 《Jmeter Interface tool practice 》 file
Interface test process :
And ordinary web The test is the same , It is also a requirement analysis first 、 Test case writing 、 Perform the test 、 Submit bug、 regression testing 、 Submit Test report, etc .
05、 The focus of interface testing
1、 Input
Input mainly refers to the input parameters of the interface , In our usual tests , Will consider the normal input first , And abnormal input parameters , Exceptions include : Parameter exception and data exception , Use case design uses equivalence class partition and boundary value analysis
Normal input parameters
Normal input parameters are well understood , It is based on the input standard of the interface design document , Enter normal parameters , Respond according to the interface design document Return to normal under certain conditions
Parameter exception
Parameter exceptions include : The parameter is empty. , More or less participation , Wrong parameters
Data exception
Data exception : Wrong data type 、 Non null parameter is null , The length does not conform to the design , Out of range data , Illegal members , special Characters or sensitive characters , Abnormal parameter data with associated relationship, etc
2、 Business logic
And based on UI The same as the functional test , Interface testing also needs to understand the business logic behind the interface , Processing logic for business processes , We You can enter parameter constraints from 、 The action object of the event 、 Business state transition and other different dimensions
Analysis of constraints
① Numerical limits : Dictionaries , Grade , Industry related restrictions , Amount limit , Score limits, etc
② The limitation of state : It works | Invalid , On-line | offline , Pull black | Wash white, etc
③ Relationship constraints : Exist or not exist , Bind or unbind, etc
④ Limits of authority : Administrators , Ordinary users, etc
Object analysis
Object analysis is mainly used to operate legal and illegal objects , For example, bank card users recharge their cards , There may be : user A Use non users A Recharge your card ; user A Recharge with your own card , The card has expired ; user A Recharge with your own card , The card is blacklist or loss report, etc .
Analysis of state transition
Such as payment business , Pay first , There will be a refund after cancellation , Pay again if payment is unsuccessful , Payment failure , Between states Whether the switching is normal , Failure to operate smoothly according to normal business , How does the status display , Is it controllable , Whether there is an abnormal state , Empty state How to deal with business, etc
Timing analysis
In some complex activities , An activity consists of a series of actions in a specified order , These actions form an action flow , Yes, in this order , To wait until the expected results , What will the program do with other branch actions that occur during execution ?
3、 Output
When considering exceptions , Usually we think of the normal situation , Invalid situation , But it may not cover all error codes , The error code returned by the interface definition can help us supplement the use cases in this part , For example, the network is abnormal , Invalid rule , Invalid parameter , Invalid business ID, Invalid task , Server exception, etc , hold errorcode More use cases can be designed by adding the values of
The design of use cases based on the output , You can find out whether the front and rear ends output results normally , Whether the prompt is friendly , Prompt whether sensitive information appears, etc
4、 Database operation
Whether business data warehousing is normal , Whether there is duplicate data warehousing , Whether there is garbled code
Whether the data update is normal , Especially the time field , Whether the time is 24 The hour format
Whether the fields in the table meet the expectations
5、 Security
Whether sensitive information is encrypted ( Such as user name 、 Bank Account , password , Transfer amount )
6、 performance
The maximum number of concurrency supported by the interface
How many services can the interface handle per second (TPS)
The average response time of the interface (RT)
The consumption of server resources by the interface (CPU、 Memory 、 The Internet 、 disk )
7、 Compatibility
Interface testing does not need to consider the compatibility of the client , Mainly data compatibility . For example, whether the historical data of the old interface is compatible , use New interfaces to handle old data , Whether it can be handled normally .
8、 other
Idempotency : It means that the result of one or more requests for the same operation is consistent , It won't have side effects due to multiple clicks .
Let's take the simplest example :
That's payment , Users pay after they buy goods , Payment and deduction succeeded , But when the result is returned, the network is different often , At this time, the money has been deducted , The user clicks the button again , At this point, the system should refuse to pay , And prompt “ You can't pay repeatedly ”. amount to The second payment will have no effect . When doing interface tests , For some interfaces with idempotent requirements , You need to test idempotent try .
It is usually possible to use Jmeter Continuous call 2 Secondary interface for payment 、 Submit and other operations , To test idempotency .
Finally, thank everyone who reads my article carefully , The following online link is also a very comprehensive one that I spent a few days sorting out , I hope it can also help you in need !

These materials , For those who want to change careers 【 software test 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful ……
If you don't want to grow up alone , Unable to find the information of the system , The problem is not helped , If you insist on giving up after a few days , You can click the small card at the bottom of the text to join our group , We can discuss and exchange , There will be various software testing materials and technical exchanges .
| Click the small card at the end of the document to receive it |
Typing is not easy , If this article is helpful to you , Click a like, collect a hide and pay attention , Give the author an encouragement . It's also convenient for you to find it quickly next time .
Self study recommendation B Stop video :
Zero basis transition software testing :38 God ! Self taught software testing , Got the byte test post offer, Is the B The best video station !
Advanced automation testing :2022 Most suitable for self-study python Automated test tutorial , Spend it yourself 16800 Bought , Now share for free !
边栏推荐
- Istio1.12: installation and quick start
- [daily question] 241 Design priorities for operational expressions
- 定了,就是它!
- From 20s to 500ms, I used these three methods
- upload-labs
- Cuckoo filter
- Attack and defense world PWN question: Echo
- What is the Bluetooth chip ble, how to select it, and what is the path of subsequent technology development
- burp 安装 license key not recognized
- 【Hot100】23. 合并K个升序链表
猜你喜欢

JASMINER X4 1U deep disassembly reveals the secret behind high efficiency and power saving

KT148A语音芯片ic的开发常见问题以及描述

Zabbix5 client installation and configuration

编写完10万行代码,我发了篇长文吐槽Rust

Motivation! Big Liangshan boy a remporté le prix Zhibo! Un article de remerciement pour les internautes qui pleurent

B端电商-订单逆向流程

Overview of browser caching mechanism

API文档工具knife4j使用详解

Embedded (PLD) series, epf10k50rc240-3n programmable logic device

JASMINER X4 1U深度拆解,揭开高效省电背后的秘密
随机推荐
KT148A语音芯片ic的硬件设计注意事项
Py之interpret:interpret的简介、安装、案例应用之详细攻略
AcWing 1125. Cattle travel problem solution (shortest path, diameter)
数据库模式笔记 --- 如何在开发中选择合适的数据库+关系型数据库是谁发明的?
AcWing 1135. Happy New Year (shortest path + search)
Design and implementation of ks004 based on SSH address book system
蓝牙芯片ble是什么,以及该如何选型,后续技术发展的路径是什么
中缀表达式转换为后缀表达式(C语言代码+详解)
Codeworks round 802 (Div. 2) pure supplementary questions
使用IDM下载百度网盘的文件(亲测有用)[通俗易懂]
KT148A语音芯片ic的软件参考代码C语言,一线串口
Istio1.12: installation and quick start
Zabbix5 client installation and configuration
From 20s to 500ms, I used these three methods
AcWing 181. 回转游戏 题解(搜索—IDA*搜索)
《MongoDB入门教程》第03篇 MongoDB基本概念
[NLP] a detailed generative text Abstract classic paper pointer generator
PXE installation "recommended collection"
RPD出品:Superpower Squad 保姆级攻略
c语言里怎么设立优先级,细说C语言优先级