当前位置:网站首页>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 !
边栏推荐
- 良心总结!Jupyter Notebook 从小白到高手,保姆教程来了!
- pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
- AcWing 343. Sorting problem solution (Floyd property realizes transitive closure)
- 《MongoDB入门教程》第03篇 MongoDB基本概念
- 面试经验总结,为你的offer保驾护航,满满的知识点
- In depth understanding of modern web browsers (I)
- JS如何取整数
- AcWing 181. Turnaround game solution (search ida* search)
- KT148A语音芯片ic的开发常见问题以及描述
- 台湾SSS鑫创SSS1700替代Cmedia CM6533 24bit 96KHZ USB音频编解码芯片
猜你喜欢
MySQL function
Zabbix5 client installation and configuration
pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
HDL design peripheral tools to reduce errors and help you take off!
Kt148a voice chip instructions, hardware, protocols, common problems, and reference codes
C language linked list -- to be added
Overview of browser caching mechanism
数据库模式笔记 --- 如何在开发中选择合适的数据库+关系型数据库是谁发明的?
KT148A语音芯片ic的开发常见问题以及描述
良心总结!Jupyter Notebook 从小白到高手,保姆教程来了!
随机推荐
[译]深入了解现代web浏览器(一)
c语言链表--待补充
Py's interpret: a detailed introduction to interpret, installation, and case application
AcWing 343. Sorting problem solution (Floyd property realizes transitive closure)
for(auto a : b)和for(auto &a : b)用法
解决方案:VS2017 无法打开源文件 stdio.h main.h 等头文件[通俗易懂]
Understanding and function of polymorphism
CRM客户关系管理系统
KT148A语音芯片ic的硬件设计注意事项
upload-labs
疫情封控65天,我的居家办公心得分享 | 社区征文
Istio deployment: quickly start microservices,
Dictionaries
451 implementation of memcpy, memmove and memset
数据库模式笔记 --- 如何在开发中选择合适的数据库+关系型数据库是谁发明的?
Embedded (PLD) series, epf10k50rc240-3n programmable logic device
Development skills of rxjs observable custom operator
Detailed tutorial on installing stand-alone redis
esp32c3 crash分析
SQLite 3.39.0 release supports right external connection and all external connection