当前位置:网站首页>Several common design methods of test cases [easy to understand]
Several common design methods of test cases [easy to understand]
2022-07-29 09:56:00 【Java architects must see】
The common design methods of test cases are : Division of equivalence class 、 Boundary value analysis 、 Wrong guess 、 Decision table method 、 Orthogonal experiment .
One 、 Division of equivalence class
seeing the name of a thing one thinks of its function , seeing the name of a thing one thinks of its function , Equivalence class division , Is to divide the test scope into several disjoint subsets , Their union is complete , Select several from each subset Representative As a test case . for example , We want to test whether a user name is legal , The user name is defined as :8 A character consisting of digits . We can draw the molecular set first : Empty user name ,1-7 Digit number ,8 Digit number ,9 Digits or more , The digital . Then select from each subset A number of Representative values : Empty user name :“” ( Invalid equivalence class instance , For software specifications , It doesn't make sense 、 Unreasonable input ) 1-7 Digit number :”234” ( Invalid equivalence class instance ) 8 Digit number :”00000000” ( Valid equivalence class instances , Be able to check whether the program realizes the functions and performance specified in the specification ) 9 Digits or more :”1234567890” ( Invalid equivalence class instance ) The digital :”abc&!!!” ( Invalid equivalence class instance ) they 5 individual , Is to divide the selected test cases with equivalence classes . actually , about 1-7 For a subset of digits , choose “234” and “11111” There is no essential difference . The partition of equivalence class , The most important thing is the division of subsets . actually , Non numbers can continue to be subsets : Letter , Special characters .
Two 、 Boundary value analysis
Long term testing experience tells us that , A lot of errors occur at the boundary of the input or output range , Not inside the I / O range . Therefore, test cases are designed for various boundary conditions , We can find out more mistakes . Selected test cases , Should be exactly equal to 、 Just bigger than 、 Just less than the boundary value , for example , For the interval min,max Value , Test cases can be recorded as min,min+,max,max-. for example , Assume X Integers ,10≤X≤100, that X The boundary value that should be taken in the test is :10,11,99,100. notes : It's just boundary values , If it is a complete test , In addition to boundary values , A normal value is also required , namely 12-98 Any value between . 3、 ... and . Wrong guess Miscalculation refers to : When testing a program , People can infer from experience or intuition that there may be various errors in the program , So as to write a method to check these error test cases . This method has no fixed form , Rely on experience and intuition , A lot of times , We all use it unconsciously .
3、 ... and 、 A false assumption
Miscalculation refers to : When testing a program , People can infer from experience or intuition that there may be various errors in the program , So as to write a method to check these error test cases . This method has no fixed form , Rely on experience and intuition , A lot of times , We all use it unconsciously .
Four 、 Decision table method
Also known as policy table , Policy table based testing , It is the most rigorous test method in functional testing . This method is suitable for logic judgment of complex scenes , The results are obtained by exhaustive conditions , Then optimize and merge the results , You will get a clearly judged strategy table . for example , A company classifies its customers as follows : The amount of each order placed by the customer is 1000 Yuan of above ( contain 1000 element ), Reputable , Order setting “ first ” sign ; Bad reputation , But regular customers , Order setting “ first ” sign ; Bad reputation , But new customers , Order setting “ normal ” sign ; The amount of each order is 1000 Yuan of the following , Order setting “ normal ” sign . Decision table drawn This table is divided into two lines , Two columns , Use different colors to distinguish . Light blue : List all conditions ( Or input ) light gray : List all results ( Or output , Action or decision ) light yellow : Enumerate the combinations of all conditions Light green : According to the conditions of each column , Judge the result Because all the conditions are exhausted , So it can be said that this judgment is 100% Correct . The next step is to merge and optimize this table . for example , From the number 1,2 You can see , Customer orders >=1000, Good reputation , Whether new or old customers , Set as priority , So the above tables are consolidated , Get the following table
such , We can get a clearer logical judgment , It can also better assist us in writing test cases . And the decision table , It's also useful for developers . From the table above , We can write more concise judgment sentences .
5、 ... and . Orthogonal experiment
Using language to describe orthogonal experiment method will be very abstract and difficult to understand , In short , That is, when the factors are independent of each other , Design a special form , Find a few test cases that can replace a comprehensive test case . among , The special table mentioned above is an orthogonal table , Is a table generated according to certain rules . Although it is a special form , The actual form of expression is no different from the general form , The main feature of orthogonal table is ,“ Uniform distribution , Be neat and uniform ”, Precisely because “ uniform ” Of , So we can replace all with a few . for example : The communication department of a university has 2 A class , Just finished a course , Want to pass “ Gender ”、“ class ” and “ achievement ” These three query conditions have an impact on the score distribution of this course in the Department of communication , The proportion of men and women or the proportion of classes . In the traditional way , We will enumerate all combinations , To write test cases , The number of combinations is 2*2*2=8. See the table below for the arrangement and combination
【 I haven't finished reading here , sorry , Come back later .】
Reference from : Several common design methods of test cases
That's the end of today's article , Thank you for reading ,Java Architects must see I wish you a promotion and a raise , Good luck every year .
边栏推荐
- Solve problems intelligently
- Will the modified data be updated when it is the same as the original data?
- [Apple Developer account]06 after transferring the developer account, the annual fee of the developer is automatically renewed
- 一文读懂Plato Farm的ePLATO,以及其高溢价缘由
- 系统架构师学习
- Functions and arrays
- The function of that sentence
- PyQt5快速开发与实战 6.1 好软件的三个维度 && 6.2 PyQt5中的布局管理 && 6.3 PyQt5的绝对位置布局
- Pyqt5 rapid development and practice 6.1 three dimensions of good software & 6.2 layout management in pyqt5 & 6.3 absolute location layout of pyqt5
- Unity xchart3.0 basic usage quick start
猜你喜欢

Network security (5)

深入浅出依赖注入及其在抖音直播中的应用

核酸扫码登记体验有感(如何提高OCR的文字正确识别率)

Zhongang Mining: four steps for sustainable and healthy development of fluorite industry

Dynamics 365Online 如何自定义商机关闭窗体

综合设计一个OPPE主页--页面的底部

English语法_不定代词 - 常用短语

SiC功率半导体产业高峰论坛成功举办

Will the modified data be updated when it is the same as the original data?

Orbslam2 installation test and summary of various problems
随机推荐
MySQL logging system: binlog, redo log and undo log
Excel tool for generating database table structure
网络安全(5)
待人宽容大度
最新翻译的官方PyTorch简易入门教程(PyTorch1.0版本)
There is still a chance
Basic operations of OpenCV image processing
RTMP supports h265 streaming
机器学习入门的百科全书-2018年“机器学习初学者”公众号文章汇总
《LOL》从代码上来说最难的是哪个英雄?
pytest+allure生成测试报告
7.9-7.17 new features and grammar of learning plan ES6
Custom configuration
深入浅出依赖注入及其在抖音直播中的应用
The latest translated official pytorch easy introduction tutorial (pytorch version 1.0)
CS assurance and research experience in 2021 (IV): pre promotion and exemption of Xijiao soft Research Institute and the third room of Information Technology Institute
What is Cartland number? What are the applications?
JS 实现全屏效果
Mysql database final review question bank
2021年CS保研经历(四):西交软院预推免、信工所三室预推免