当前位置:网站首页>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 .
边栏推荐
- Implementation and verification logic of complex expression input component
- Is it safe to open an account online now? Do you want to know that you must go to the business hall to open an account now?
- Be tolerant and generous
- Unity3d空包打apk报错汇总
- MySQL infrastructure: SQL query statement execution process
- Read Plato farm's eplato and the reason for its high premium
- 怎么样的框架对于开发者是友好的?
- 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
- PyQt5快速开发与实战 6.4 QBoxLayout(框布局)
- Network security (6)
猜你喜欢

How to customize the opportunity closing form in dynamics 365online

What kind of framework is friendly to developers?

i.MX6ULL驱动开发 | 32 - 手动编写一个虚拟网卡设备
![[苹果开发者账号]06 转让开发者账号后,开发者年费自动续费问题](/img/a7/12fd63f16ebca81a3dd2d1b97847d1.png)
[苹果开发者账号]06 转让开发者账号后,开发者年费自动续费问题

机器学习入门的百科全书-2018年“机器学习初学者”公众号文章汇总
![[ts]typescript learning record pit collection](/img/4c/14991ea612de8d5c94b758174a1c26.png)
[ts]typescript learning record pit collection
![[ts]Typescript学习记录坑点合集](/img/4c/14991ea612de8d5c94b758174a1c26.png)
[ts]Typescript学习记录坑点合集

网络安全(6)

Node (II)

Yin Yi: my learning and growth path
随机推荐
MySQL infrastructure: SQL query statement execution process
程序员脱离单身的一些建议
Briefly describe the difference between heap and stack
TCP failure model
机器学习之逻辑回归(Logistics Regression)
【C语言】三子棋(智能下棋 + 阻拦玩家)
Unity3d hodgepodge
Linear regression of machine learning (least square handwriting +sklearn Implementation)
Appendix 2 – some simple exercises
Some suggestions for programmers to leave single
Behind 100000 visits...
Encyclopedia of introduction to machine learning - 2018 "machine learning beginners" official account article summary
Be tolerant and generous
怎么样的框架对于开发者是友好的?
HarmonyOS 3.0 发布!
Excel tool for generating database table structure
英特尔联合Datawhale,发布学习项目!
shell编程之sed,正则表达式
Four types of technical solutions shared by distributed sessions, and their advantages and disadvantages
node(二)