当前位置:网站首页>Only simple function test? One article takes you to advanced interface automatic testing technology in 6 steps
Only simple function test? One article takes you to advanced interface automatic testing technology in 6 steps
2022-07-29 10:00:00 【Peng Yuyan in the testing industry】
Speaking of testing , The first reaction is functional testing, which accounts for more than half of the testing industry .
However, in the face of the increasing complexity of software and functions , Functional testing is not completely applicable . Automated testing happens in this environment .
Automated testing itself is divided into UI、 Interface and unit test , But based on UI The means of automated testing technology are inefficient, complex and error prone , It has been unable to meet the actual needs .
Under the background that the iteration speed of Internet products is accelerating step by step , There is less and less time for regression testing , It is difficult to do a complete regression of all functions in each iteration .
The interface automation test is simple to implement 、 Low maintenance cost , Easy to improve coverage and other characteristics , More and more attention is paid to . Especially for the highly complex Internet enterprise platform , The more complex the system is , The more obvious the effect of interface test automation and continuous integration .
When automating test auxiliary function test , obviously Interface automated testing has become the optimal solution .
Of course , At present, the testing industry is mainly functional testing . But with the continuous influx of career changers and graduates into the testing industry , Functional testing in the testing industry “ The gap ” It's almost saturated .
Want to continue in the software testing industry , We must have core competitiveness , Mastering interface automation testing technology is an essential skill .
Open the major recruitment software and you will find , Interface testing gradually becomes major tests JD One of the hard requirements of :
The key is coming. , How to learn interface automation testing
Reading guide : In all development testing , Interface testing is essential . Effective and complete interface testing , It can not only guarantee the development quality of new functions , It can also give developers the ability to regress when modifying the functional logic , At the same time, it is also the premise of elegant refactoring . What are the principles for writing interface tests ? What should the structure of the test code look like ? What are the practical skills of interface testing ? This article shares the author's experience in interface testing .
Software test engineer is a high-tech post , But now many people mistakenly think that the test engineer is “ Spot work ”, Get the software “ Dot ”, You can complete the test , No technical content , And some test engineers' wrong working methods also contribute to this misunderstanding .
1、 What is interface testing
Interface test is a test to test the interface between system components . The interface test is mainly used to detect the interaction points between the external system and the system as well as between the internal subsystems . The focus of the test is to check the exchange of data , Transfer and control the management process , And the mutual logical dependence between systems .
2、 Why do interface tests
- The rapid development of the Internet , There are more and more connections between internal systems and external systems , A business process is associated with multiple back-end systems , Their association is based on the interface , Interface testing can simplify complex system relationships , As long as the test of each interface is done well, the system quality can be better guaranteed .
- Changes to a single system , Whether it will affect the associated business system , It is difficult to cover the related application system with conventional testing aspects ( For example, use the external The system has N individual , It's impossible to do a functional compatibility test every time ), However, we can verify whether it will affect other people's calling of the interface by covering the function of the interface .
- The interface function is relatively single , Can be a good test coverage , It's also relatively easy to automate continuous integration ,, It can reduce the cost and time of manual regression , Shorten the test cycle .
- Interface versus interface function , It's going to be a little bit lower , Test coverage will be easier ( For example, the business makes a judgment when calling the interface , When the condition is not met, the link is not displayed , At this time, it is impossible to test whether the relevant functions are well judged from the interface , It's easier through the interface )
3、 The scope of interface testing
- a) Business function ( Including normal 、 Whether the exception scenario is implemented )
- b) Business rules ( Is the coverage comprehensive )
- c) Parameter validation ( The border 、 Whether the business rules meet the requirements )
- d) Abnormal scenario ( Repeated submission 、 Concurrent commit 、 Business interruption 、 Multi machine environment 、 Big data test )
- e) Performance testing ( response time 、 throughput 、 Concurrency number 、 Resource requirements )
- f) Security testing ( Authority verification 、SQL Injection, etc. )
4、 Key points of interface test
- a) Check whether the data returned by the interface is consistent with the expected result .
- b) Check the fault tolerance of the interface , If the type of data passed is wrong, can it be handled .
- c) Interface parameter The boundary value . for example , When the parameter passed is large enough or negative , Whether the interface can handle normally .
- d) Interface performance ,http The request interface is mostly related to the back end execution SQL Sentence performance 、 Algorithm and so on .
- e) Interface security , The interface of external calls is particularly important .
5. Testing principle
Basic principles :
1. automation : Interface testing is non interactive automated execution , No one needs to be involved .
2. independence : Interface tests should not depend on each other .
3. repeatable : Interface tests can be repeated , Not affected by the environment .
4. Interface testing follows BCDE principle , Ensure the quality of interface delivery . - Border: Boundary test . - Correct: Correct input , The right expected output . - Design: Write test logic according to requirements and design documents . - Error: Wrong input , Expected output .
- Data preparation : Data preparation is done through system services , You can't insert it directly db The way .
- Testability : The unmeasurable code needs to be restructured .
- Coverage : Interface testing needs to cover all UC, At the same time, code coverage and branch coverage should reach a certain standard , New code must be overridden .
- Continuity : If code modification causes existing interface test execution to fail , You have to fix code problems or test code logic .
- Time requirement : Interface testing should be done before the project is released , It should not be added after the release of the project .
The above basic principles should apply to all layers of automated test cases , When writing interface tests , In addition to the above principles , There are other principles to follow , Let's look at a picture :
From the system point of view to analyze the entry call , With HSF Service as an example : - The peripheral system calls the services provided by our system . - The system executes a lot of code logic , It contains branch logic . - The execution of the system depends on external HSF service , Made a call , And get the return value . - System execution depends on DB Query or landing data , Depending on cache query or landing data . - During the execution of the system, messages are sent out . - Back to the upstream system HSF Execution results .
The key principle of effective interface testing is to cover all entries ,mock All dependence , Check the traces left in the execution process , Summarized below : - The entrance covers : Interface test cases must cover HSF Service entrance 、 Message entrance 、 Timed task entry . - rely on mock: In the basic principles , There is the principle of repeatability , That is, interface testing cannot be environment dependent , need mock Lose dependence on foreign countries . But for the db rely on , It is not recommended to completely mock fall , One side mock The high cost , In addition, it may not cover sql And table constraint logic . - Check the integrity : Effective interface testing , It should have complete verification , Interface testing without verification is meaningless . As long as the execution process , The traces left have an impact on the business , All of them have to be checked completely , To ensure the effectiveness of interface testing .
HSF Interface return value verification : Follow the scenario and interface conventions HSF Return parameter verification . - DB check : Verify the correctness of landing data . - Cache verification : Verify the correctness of the data stored in the cache . - HSF Rely on input parameter validation : adopt mock Tools get dependent on HSF The input parameter of the call , Check the input parameters . - Message verification : adopt mock The tool gets the message object sent , Check the message body .
6、 Common tools for interface testing
1、JMeter
JMeter yes Apache Organization development based on Java Pressure testing tools for , Be able to translate requests into scripts to implement , And allow the use of regular expressions to create assertions to determine the result of the request , Have the ability of interface test function and performance .
2、Robot Framework
Robot Framework Is a Python The framework of functional automation test . Good scalability , Keyword Driven , You can test multiple types of clients or interfaces at the same time , You can do distributed test execution . Commonly used in many rounds of acceptance testing and acceptance test driven development (ATDD).
3、SOAPUI
SoapUI Is a complete automated testing solution . Support SOAP and REST Of Web service ,JMS Enterprise message layer , database , Rich Internet applications , wait . And in the SoapUI, You get it all from its intuitive and powerful user interface . For a higher degree of Automation ,SoapUI Command line tools are also available , Functions that let you run / Load testing and almost all task schedulers , Or as part of your build process MockServices Set .
4、PostMan
Postman Is a powerful web debugging and sending pages HTTP Requested Chrome plug-in unit , Have Fiddler、httpwatch And other tools to debug the function of the request , At the same time, it has the function of interface management , The official website improves the script save synchronization function , Support interface import and export .
A little help ~
Finally, thank everyone who reads my article carefully , Watching the rise and attention of fans all the way , Reciprocity is always necessary , Although it's not very valuable , If you can use it, you can take it
These materials , For those who want to advance 【 automated testing 】 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 …….
边栏推荐
- 数据库表结构生成excel工具
- SiC Power Semiconductor Industry Summit Forum successfully held
- C# 值类型和引用类型讲解
- MySQL logging system: binlog, redo log and undo log
- A Zuo's realm
- Senparc.Weixin.Sample.MP源码剖析
- Virtual machines use host graphics cards (Hyper-V and wsl2)
- i.MX6ULL驱动开发 | 32 - 手动编写一个虚拟网卡设备
- Dynamics 365Online 如何自定义商机关闭窗体
- Window系统操作技巧汇总
猜你喜欢
7.9-7.17 new features and grammar of learning plan ES6
一文读懂Plato Farm的ePLATO,以及其高溢价缘由
英特尔联合Datawhale,发布学习项目!
leetcode刷题——排序
程序员脱离单身的一些建议
[wechat applet] interface generates customized homepage QR code
一知半解 ~题目杂记 ~ 一个多态问题
vector实现
The latest translated official pytorch easy introduction tutorial (pytorch version 1.0)
What kind of framework is friendly to developers?
随机推荐
Pyqt5 rapid development and practice 6.4 qboxlayout (box layout)
Unity3d空包打apk报错汇总
Shell notes (super complete)
Network security (6)
Enterprise architecture | togaf architecture capability framework
QoS服务质量五QoS边界行为之流量整形
【C语言】三子棋(智能下棋 + 阻拦玩家)
Senparc.Weixin.Sample.MP源码剖析
My problem solving record 1: the @component annotation is used on the class. If you want to use the methods in this class, you can't directly new, but should use @autowired for injection, otherwise an
Zhongang Mining: four steps for sustainable and healthy development of fluorite industry
PyQt5快速开发与实战 6.1 好软件的三个维度 && 6.2 PyQt5中的布局管理 && 6.3 PyQt5的绝对位置布局
2021年CS保研经历(六):系统填报 + 一些感想
MySQL logging system: binlog, redo log and undo log
Sublime Text3 设置不同文件不同缩进
【微信小程序】接口生成自定义首页二维码
【C语言】扫雷(递归展开 + 标记功能)
Correct posture and landing practice of R & D efficiency measurement (speech ppt sharing version)
Pytest+allure generate test report
Reasons for the rise of DDD and its relationship with microservices
Function - (C travel notes)