当前位置:网站首页>Test case design method
Test case design method
2022-06-11 23:38:00 【Channeling monkey__】
1. Test case introduction
Definition of test cases :
For a business goal , And a set of test inputs , A case of execution conditions and expected results
2. Why learn test cases ?
- Design test cases before you start testing , It can avoid blind testing and improve testing efficiency .
- The use of test cases highlights the implementation of software testing 、 Have a clear purpose .
- After the software version is updated, only a few test cases need to be corrected to start the testing work , Reduce work intensity 、 Shorten the project cycle .
- Verify that the software meets customer requirements 、 Reflect the workload of a tester 、 Show the design idea of test case .
3. Use case core elements
- Must master : Use case number ( How to name )、 The module it belongs to 、 Use case title ( Verify who and under what circumstances , What will you do? , What's the end result )、 priority 、 precondition 、 Operation steps 、 Test data 、 Expected results 、 The actual result
Understand the content : Pass or not 、bugID、 Prepared by 、 Time of writing 、 Testers 、 Test time 、 remarks
4. What is a high quality test case
- Test cases cover all user requirements
- Test cases should be simple and clear
- All types of test cases should be complete
- Cover the most requirements with the least use cases
① Division of equivalence class
Definition : Equivalence class division It is to divide all the possible input data into several areas , Then take a small number of representative from each area Test the data of .
Equivalence class : What is equivalent class , A collection of input fields , In this set, each input condition is equivalent .
Equivalence class classification :
Generally, it can be divided into effective equivalence class and invalid equivalence class .
- Effective equivalence class : To conform to 《 Requirements specifications 》, Enter a reasonable set of data
- Invalid equivalence class : Means not in conformity with 《 Requirements specifications 》, Input unreasonable data set
type
Value range type : Enter student grades 0-100
Identity type : Only one result is correct , Everything else is wrong for example The grand prize in the lottery
Boolean type : Choose by whether or not , Agree to an agreement
Enumeration type : Give the options , As long as any one of them fits For example, choosing a degree
Type of rule : Given requirements , Just meet the requirements , Like email
The type of character that can be filled in any text input box : chinese 、 english 、 Special symbols 、 Space 、 Numbers .
Case a :
Divide equivalence classes and number , The following table is the result of equivalence class partition

Case 2 :

② Boundary value analysis
Definition
Definition : Boundary value analysis It is to take some data slightly higher or lower than the boundary for testing .
reason : When developing the loop body, the access may be due to <,<= mistake .
For example, the following code :
// Efficient equivalence partition -1 0 100 101
for(int i = 0;i <100; i ++) {
int j = i+1;
System.out.println(" Circle the first “+j+" Time ")// Do something in a cycle
} The program here is a loop 100 Time , So I can do 100 Time ;
If the programmer is not careful , hold i <100 It's written in i <= 100, It will overflow , In this case, boundary value checking is a good test method .
The way to determine the boundary value :
- Upper point : A point on a boundary , Whether the field is an open interval or a closed interval , Open range , The last point is outside the territory , If it's a closed interval , The last point is in the domain .
- Departure point : The point closest to the upper point , It has something to do with whether it is a closed interval or an open interval , If it's an open interval , So the departure point is in the domain , If it's a closed interval , So the departure point is outside the territory .( Open the inside and close the outside )
Principles to follow : Open the inside and close the outside Open the interval and look in the middle , Close the interval and look outside - Inside point : Any point in a field is an interior point .
0<=x<=10 Top left 0 Left off point -1 Right away 11 Top right 10 Inside point 5
0<x<10 Top left 0 Left off point 1 Right away 9 Top right 10 Inside point 5
0<=x<10 Top left 0 Left off point -1 Right away 9 Top right 10 Inside point 5Boundary value and equivalence class de duplication
1. Case a :
File management system , The format of user input date is “ Specific date ”, The scope is 1990 year 1 month ~2049 year 12 month . Example :19900101-20491231

Case 2 :

Test point analysis :
1、 Read the needs 3-5 All over
2、 Punctuation
3、 Converse thinking
4、 Questions ③ Cause and effect diagram
Definition
Causality diagram method is more suitable for the situation with more input conditions , Test the permutation of all input conditions . The so-called reason is input , The result is the output .
The writing process of causality diagram test case
1、 Determine the cause 、 result 、 The middle process
2、 Connect the cause and effect diagram
3、 Indicate constraints
4、 Output test cases
Case a : Vending machine
Requirement specification :
There is a processing unit price of 2.5 The vending machine software for boxed drinks . If you put in 2.5 Yuan coins , Press “ coke ”、“ beer ”、 or “ Milk tea ” Button , The corresponding drink will be delivered . If the investment is 3 Yuan coins , Return the drinks as they are delivered 5 Dimes .
analysis :
reason ( Input ): In the middle result ( Output )
input 2.5 Yuan coins ; The coin has been put in / Button has been pressed return 5 Dimes ;
input 3 element ;
Press “ coke ” Button ; Send out “ coke ” drinks ;
Press “ beer ” Button ; Send out “ beer ” drinks ;
Press “ Milk tea ” Button . Send out “ Milk tea ” drinks ;④ Wrong guess
Definition
Error guessing is a test case design method that people with rich test experience like to use .
Generally, this method is based on experience and intuition to infer various errors that may be sent in the program , Targeted design . Only as a supplement .
application
Enter a string of numbers , The program can automatically sort from small to large
Email format @ In accordance with the full angle and half angle case
Case study
Test the call function of mobile terminal , Various call failures can be designed to supplement the test example :
nothing SIM Exhale when the card is inserted ( Non emergency call )
Insert overdue SIM Card for exhalation
If the RF device is damaged or no signal area is inserted, it is effective SIM Card exhaled
Normal network , Insertion works SIM card , Invalid number ( Such as 1、888、333333、 Don't enter any number, etc )
Normal network , Insertion works SIM card , Use “ Speed dial ” The number of invalid number set by function call out
skill
The most important thing is to think about and analyze all aspects of the test object , Refer to what you found before bug Relevant data , Lessons learned , Individuals think more about abnormal situations 、 On the other hand 、 Special input , Treat the program as an attacker , Can design a more perfect test case to .
⑤ Decision table
Definition :
When designing test cases , Analysis and expression of multi input conditions to perform different operations of the black box test method .
Be careful : This method is similar to the cause and effect diagram method .
Decision table test case writing process
1、 Determine the cause and action
2、 Permutation and combination
3、 Mark the relationship between the results
4、 Output test cases
Case study
requirement :
Scanning gun scanning body machine code, automatic identification of car brand and model , For engine power greater than 100 A powerful car also The maintenance record is incomplete or the mileage exceeds 20 Ten thousand kilometers of cars , Cooperation should be given 4s Store priority maintenance
Conditions 1 2 3 4 5 6 7 8
The power is greater than 100 horsepower
Incomplete maintenance records
More miles than 20 Thousands of kilometers
action
4s Store priority
Other treatments ⑥ Orthogonal experiment
- Using tools : Orthogonal table
- The orthogonal experiment method is to use a well arranged table - Orthogonal table to design the experiment as a whole 、 Comprehensive comparison 、 Statistical analysis , Through a small number of experiments to find better production conditions , In order to achieve the highest production process effect .
- This experimental design method is to select an appropriate amount of representative points from a large number of test points , Use the form you've made — Orthogonal table to arrange experiments and data analysis method .
- Orthogonal table can sample evenly within the range of factors , So that each test has a strong representativeness , Because the orthogonal table has the characteristics of balanced dispersion , Some requirements of comprehensive experiment are ensured , These experiments often can better or better achieve the purpose of the experiment .
- The design of orthogonal experiment includes two parts : First of all , How to arrange the experiment ; second , How to analyze the experimental results .
Application scenarios
There are multiple controls in an interface , Each control has multiple values , Controls can be combined with each other , impossible ( There's no need ) Write a use case for each combination , How to test with the least optimal combination .—— Orthogonal array method


Use the orthogonal design assistant
(1) Download and unzip the orthogonal design assistant
(2) File new project
(3) Experiment new experiment
One . Experimental instructions

Two . Choose an orthogonal table

3、 ... and . Factors and levels

Four . determine

What are the characteristics of orthogonal table test case design method ?
1、 Cover the most operations with the least number of experiments , There are few test case designs , Efficient , But it's complicated ;
2、 For basic verification functions , And the defects caused by secondary integration , You can usually find out ; But deeper flaws , More complex defects , There's nothing I can do about it Of ;
3、 In a physical environment , Orthogonal arrays are generally difficult to do . majority , Use this method only for system testing .
⑦ Scene method
Definition
Describe the function point or business process of the system by simulating the business scenario , So as to improve the test effect of the black box test method
ATM Introduce the scene method

Schematic diagram

Two streams
Basic flow
- Concept
The right process - technological process
Card insertion → Input password → Choose services → Withdraw money → Select amount → Waiting for cash out → Take out the card
Alternative streams
- Concept
There are abnormal processes , For elementary flows, every step is reversed - technological process
Card insertion → Input password → Wrong password → Re input → The password is correct → Choose services → Withdraw money → Select amount → Waiting for cash out → Take out the card
Scenario method test case writing process
- Analyze user scenarios
- The design scenario covers basic flow and alternative flow
- Output test cases
Case study
- Requirement specification :
There are three steps to registering a website , Enter phone number , password , Enter the correct phone verification code 、 And agree to the service agreement , Click Apply now , Registered successfully . Give a friendly prompt when the information is filled in incorrectly , Explain the cause of the error . After successful registration, send a message to the registered user , The information is as follows :“ Hello! !Xxx user , Welcome to register , Please complete the real name authentication in time .” - Analysis method :
① Read the needs : Familiar with 3-5 All over , Reading needs
② Punctuation : Organize the requirements into requirements
③ classification : technological process / The rules
④ Converse thinking : Think about it in different ways
⑤ question : Find out where you have doubts
⑥ Apply test case analysis method

Use the corresponding test case method to write test cases for test points , One test point corresponds to one or more test cases , The test case can only correspond to a test point .
边栏推荐
- CD process
- 2022 high voltage electrician test question simulation test question bank and online simulation test
- [day6-7 intensive literature reading] a unifying Bayesian framework accounting for spatiotemporal interactions with a
- (dp+ longest common subsequence) acwing 897 Longest common subsequence
- oracle中dblink操作
- Jetpack架构组件学习(3)——Activity Results API使用
- What are the pitfalls of redis's current network: using a cache and paying for disk failures?
- PHP mkdir(): permission denied uploading a file will change the folder permission to 411 permission
- CVPR 2022 | 元学习在图像回归任务的表现
- HMS core shows the latest open capabilities in mwc2022, helping developers build high-quality applications
猜你喜欢

HMS core shows the latest open capabilities in mwc2022, helping developers build high-quality applications

Read the logstash principle

Procédures d'introduction et d'installation de sonarqube

05 classification learning notes lihongyi's in-depth study 2021

The latest "capsule Network Overview" paper of imperial technology, etc., 29 pages of PDF, expounds the concept, method and application of capsule

Pad printing process flow and application precautions
![[Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry](/img/c2/e70e7c32c5dc5554dea29cb4627644.png)
[Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry

Wechat applet Bluetooth development
![[Day10 literature extensive reading] temporary cognition can affect spatial cognition more than vice versa: the effect of](/img/f7/03709322088b9ec57b20e49110d420.png)
[Day10 literature extensive reading] temporary cognition can affect spatial cognition more than vice versa: the effect of

2022 high place installation, maintenance and removal of simulated examination platform for operation certificate examination question bank
随机推荐
Here we go! Dragon lizard community enters PKU classroom
[tense] 1. General present tense 2. Do not translate Chinese
Lake Shore—SuperTran-VP 连续流低温恒温器系统
[Day10 literature extensive reading] temporary cognition can affect spatial cognition more than vice versa: the effect of
Lake Shore - supertran VP continuous flow cryogenic thermostat system
[Delphi] determine the encoding method of the file (ANSI, Unicode, utf8, unicodebig)
In order to stimulate inspiration and creativity, Shanghai daoning united with XMIND to bring you full-featured mind mapping and brainstorming software
El select drop-down box style combined with El table (pseudo) combined with drop-down selection
Lake Shore—SuperVariTemp 低温恒温器
New Year Countdown JS case
[C language] data type storage, original code, inverse code and complement code
Altium designer工程下多个原理图和PCB图的一一对应
How to completely modify the user name in win10 system and win11 system
(simple statistics) acwing 3404 Who are your potential friends
Live broadcast preview | featurestore meetup V3 is coming!
Implementation scheme of iteration and combination pattern for general tree structure
Beginner JS BOM implementation window centered
CVPR 2022 | 元学习在图像回归任务的表现
Lake Shore—SuperTran 连续流低温恒温器系统
免费分享1个新媒体运营必备的宝藏网站