This is too awesome, easy to write test cases

1. Concept

Basic concepts of test cases:

Test Case (Test Case) is a set of collections provided to the system under test for the purpose of implementing the test. This set of collections includes: test environment, operation steps, test data, expected results and other elements.

The main steps:

Test environment - test steps - test data - expected results

Netease mailbox registration success test case

Title: Email Registration, Email Input Test

Simple case:

image-20220109225709851

 

Second, the overall design of the test case

Requirements-based design, RBT (Requirements-Based Testing) is a requirements-based testing method, which will make testing more effective, because it makes testing focus on the root cause of quality problems, that is, requirements. [Click on the small card at the end of the article to get free test resources]

1. Design and analyze test cases from an overall perspective: based on requirements

User requirements - (sort out software requirements) product design documents (product manager) - development - testing - online

(1) Verify the correctness and rationality of the requirements

(2) Analyze requirements, refine requirements, decompose test items from requirements, find out functions according to test items, and write test cases.

case:

User needs:
Buy Huawei smartphones within 3,000 yuan.

For example: there is an event where 5999 is 1 yuan, and this is also the price of the river.

Test case:

(1) Reasonable

(2) Analysis:

Price: <=3000;

Brand: Huawei

Phone Type: Smartphone

Basic functions of mobile phone:…

Software Requirements:
Event Flow

If the user has not received the activation email, he can enter the email and password on the login interface, and then send the activation email again.
The activation email sent each time is only valid within 24 hours after sending the email, and the activation email needs to be resent after 24 hours.
Test case:

1. After the user receives the email, the activation email will not be sent here;

​ The user receives the email, enters the email and password again, and prompts: the email has been activated;

​ If the user does not receive the email, send the activation email again;

2. Valid within 24 hours

​ More than or equal to 24 hours, invalid activation email

​ Boundary value: 24 hours to click to activate, 25 hours to resend the email

It is easy to ignore: if you have clicked the activation email within 24 hours, and reactivated after 24 hours, it will prompt "The system has been activated:.
 

Test the basic functionality of activation mail:

Can the email be opened
? Whether the format and content
of the email are correct; whether the activation link in the email is normal;
these are logic test cases.

1. Equivalence class☆

The equivalence class is to divide the input into several equivalence classes, and take a test case from each equivalence class. If the test case can pass the test, then we say that the equivalence class represented by the test case has passed the test. (Example of wardrobe sorting clothes)

In layman's terms, data sets with certain common characteristics are divided! !

Usage scenario: Test cases cannot be exhaustive, and we cannot test the same.

Effective equivalence class: a data set that conforms to the program specification;

Invalid equivalence class: a data set that does not conform to the software requirements specification;

step:

案例一:
需求:验证qq账号的合法性
要求:6~8为自然数

Case number one:

image-20220213174357895

 Case 2 (telephone):

需求:验证某城市电话号码的正确性
要求:
1.区号:空或者是三位数字
2.前缀码:非“O”且非“1”开头的三位数字
3.后缀码:四位数字

image-20220214181555209 

2. Boundary value☆

Design test cases for the boundaries of inputs and outputs.

case:

Buy Huawei smart phones within 3,000 yuan

Price: <=3000, 3001 will not work

Equivalence class:

Valid equivalence classes: less than 3000

Invalid equivalence class: greater than 3000

Boundary values: 2999 3000 3001

2.1 Boundary value method design use case steps

1. Clear requirements

2. Identify valid and invalid equivalence classes

3. Determine the boundary range value

4. Extract data and write test cases

Case number one:

需求:通过边界值法验证标题长度的合法性
要求:标题大于0,小于等于30个字符

image-20220214201754883

Added: Boundary range node:

 1. Upper point, point on the boundary

2. From the point, for example, the nearest point on the boundary (just greater than, just less than) follows the principle of opening inside and closing outside

3. Inner point, point within the range.

optimization:

Points on the boundary: open inside and close outside.

3. Judgment table☆

Solve the multi-condition dependency problem.

1. Definition: It is a tool for expressing multi-conditional logic judgments in tabular form.

2. Composition:

Condition pile: List all the conditions in the question
Action pile: List the possible actions in the question
Condition items: List the values ​​corresponding to the conditions, the true and false values ​​under all possible conditions
Action items: List the condition items, each The result of the action that should be taken in the case of a value.

Rules:
1. A column running through condition items and action items in the decision table is a rule
2. Assuming there are n conditions, each condition has two values ​​(0,1), and there are 2 to the nth power of all combinations rule

3. Steps:

1) Define the needs

2) Draw a judgment table

List the condition piles and action piles
Fill in the condition items and make a full combination of the conditions 3), determine the action item according to the combination of the condition items
Simplify and merge similar rules (with the same action)
3) Write test cases according to the rules

4. Case 1:

image-20220215111953335

应用场景:
1、有多个输入条件,多个输出结果,输入条件之间有组合关系,输入条件和输出结果之间有依赖(制约)关系
2、判定表一般适用于条件组合数量较少的情况(比如4个条件以下)
3、提示:如果碰到项目中多条件组合大于4个相互依赖,可以使用
(正交表和因果图来实现)

4. Causal diagram

When there are many inputs, and different input combinations correspond to different outputs, at this time, the causal graph method is used to analyze the correspondence between different input combinations and outputs. (equivalent to a logic diagram) 

Logical relationship: identity and or not

image-20220110195249867 

Steps to design test cases by causal diagram method:

1. Analyze all inputs and outputs;

2. Find out the relationship between output and output;

3. Draw a causal diagram;

4. Draw a judgment map;

5. Convert the decision table into test cases;

Case: Taobao 618 event, the order is over 300, or there is a red envelope, and you can enjoy the discount after submitting the order.

1. Input and output

Input: amount<300, amount>300, amount==300, with or without red envelope, submit the order

Output: enjoy the discount, not enjoy the discount

2. The relationship between input and output

The order has been submitted, the amount is greater than or equal to 300, no red envelope, enjoy the discount; the
order has been submitted, the amount is greater than or equal to 300, there is a red envelope, enjoy the discount; the order has been submitted, the amount is less than 300, there is a red envelope, enjoy the discount
;
the order has been submitted, the amount is less than 300, no red envelope, no discount;
no order submitted, no discount;

3. Draw a causal diagram

image-20220110201624623

4. Judgment table based on causal drawing

image-20220110205150297

5. Scene Design Method☆

Almost all current software uses event triggers to control the process. The scene when the event is triggered forms the scene, and the different trigger sequences and processing results of the same event form the event flow. This method can vividly describe the situation when the event is triggered, which is helpful for the test designer to design the test case, and makes the test
case easier to understand and execute.

A typical application is to use business flow to string together isolated function points to create an overall business feeling for testers, so as to avoid the wrong tendency of falling into functional details and ignoring business process points.

case:

ATM machine withdrawal scene

Function points: insert card - enter password - enter money amount - withdraw money (main function, core process)

Specific function points:

(1) Card insertion: reverse insertion, wrong card insertion (meal card, membership card, not the bank card), cancellation, degaussing, freezing, cards with bad records

(2) Input password: wrong password, correct password input, wrong password three times, wrong password for the first time, correct password for the second time, wrong password for the first two times, correct password for the third time

(3) Enter the amount of money: amount of money <= bank card balance, input amount of money >= bank card balance, input is not a whole hundred, ATM machine balance is insufficient, exceeds the daily withdrawal limit, exceeds the maximum limit of each withdrawal, exceeds The maximum number of withdrawals per withdrawal.

(4) Withdrawal: After confirming the amount of money withdrawn, the ATM machine will spit out the corresponding amount of money; the ATM machine spits out the rules, the operation is timed out, and the money will not be spit out for a long time;

(5) Others: The ATM machine is disconnected from the network, the power is cut off, and there is a failure; timeout, if all operations timeout, then there will be a card swallowing (safety mechanism)

Test cases can be written for each specific function point.

For example: 1. The card is inserted backwards: the second re-insert is correct, and money can still be withdrawn normally; the card is frozen/cancelled, and money cannot be withdrawn normally;

      2. If you enter the wrong password three times, the account will be frozen and you will not be able to withdraw money; if the first two passwords are wrong and the third password is correct, you can still withdraw money normally

Test case:

image-20220215121219113

6. Wrong guessing method

According to the intuition, knowledge, and experience of the testers, it is judged that there is a problem with the software, and the design of test cases is specially designed, which is suitable as a method of supplementary design of test cases.

For example: 1. The verification code is case-insensitive;

      2. Space search, ignore the spaces before and after the input search information;

7. Orthogonal arrangement

A method of studying multi-factors and multi-levels. According to the orthogonality, the optimal level combination is selected for experiments, and the results of the experiments are used to analyze the results of this test case. (Choose the best combination)

Factor: the input variable;

Level: the value of the factor;

Number of factors: the number of variables;

Number of levels: the maximum number of variable values;

Properties of orthogonal tables:

1. The number of occurrences of different data in each column is the same;

2. The number of occurrences of each data combination in any two columns is the same;

image-20220110221335796

Orthogonal table design test case steps:

1. Find all input variables (factors) and determine the number of factors;

2. Determine the value of the variable and determine the number of levels;

3. Determine the rows and columns of the orthogonal table;

4. Fill in the orthogonal table according to the nature of the orthogonal table

5. Write each row of the orthogonal table as a test case;

6. Supplement the test cases that you think are important but not reflected in the orthogonal table;

Example: name, email address, password, confirmation password, verification code (input and no input)——do not use the orthogonal table to list 2^5=32 cases

1. Factor: 5

2. Number of levels: 2 (input and non-input)

3. Row: (level number-1)*factor number+1=6

​ Columns: Number of Factors: 5

4. Fill in the orthogonal table

image-20220110223037980 

5. Test case:

(1) Name input, email address not input, password input, confirmation password input, verification code not input;

(2) Name input, email address input, password not input, confirmation password not input, verification code input;

(3) Name input, email address input, password input, confirmation password is not input, verification code is not input;

(4), do not enter the name, do not enter the email address, do not enter the password, enter the confirmation password, and enter the verification code;

(5) Can’t enter the name, enter the email address, enter the password, enter the confirmation password, and enter the verification code;

(6) No name, no email, no password, no confirmation password, no verification code;

3. Points to pay attention to in actual operation

3.1 Notes on test cases

image-20220212211347313

作用:方便评审,方便执行
1、用例标题:预期结果(测试点)
2、验证码测试点:为空,正确,错误,过期
3、前置条件和测试步骤,测试步骤是按前置条件后进行的,要么前置条件写的多,要么测试步骤写的多。

Qualified test case title:

 image-20220212212136181

 

4. Defect introduction

Any problem in the use of the software is a defect, referred to as: bug

1. Criteria for judging defects

The software implements the functions clearly required in the requirement (specification) specification—fewer functions.
The software has a fatal error that should not appear in the requirement (specification
) specification—functional error. (Example: barber shop)
The requirements (specifications) in the software have not been fulfilled, although they are not clearly stated in the manual, but should be fulfilled—invisible functional errors (example: ordering food on a mobile phone, showing what dishes are available) The testers think that the software is difficult to understand and easy to use
, Slow, bad user experience — difficult to use

2. The cause of the defect

image-20220212152748622
It's the software that has bugs! ! ! ! ! !

3. The core content of software defects

image-20220212160436183

image-20220212161010041

4. Defect type

Functional errors
Interface (Ui) errors, compatibility (front-end)
data, usability, improvement suggestions, architecture

1、如何区分是前端bug还是后端bug
1)、如果是界面和兼容性问题——前端问题
2)、如果是功能错误,需要 抓包 查看请求和响应!

Extension: what is packet capture

image-20220213163149180

5. Defect writing

1. Example of defect report:

 image-20220212202318168

 2. Defect tracking process

image-20220212203125572

 Interview question: What do you do first when you find a bug? ——Confirm that the bug can be reproduced.

5.1 Deficiency Exercises

Error demonstration:

image-20220212212231694

 

1、缺陷Id:使用了用例id
2、标题:操作数据描述+预期+实际
		测试数据结果描述+实际结果+预期
		测试数据结果描述+实际结果+需求
3、缺陷描述:操作步骤+数据

Correct example:

image-20220215123649487

Examples of defect titles:

1. Test data description + actual results + expectations:

The unqualified 4-digit qq verification is qualified (expected: failed) and the
empty password is successfully logged in (expected: failed to log in, prompting that the password cannot be empty)
2. Test data result description + expected + actual

Verification of 4-digit qq is unqualified (actual: qualified)
verification of empty password login is unsuccessful (actual: login successful)
3. Test data description + actual result + demand

Unqualified 4-digit qq verification is qualified (requirement: 6-10 natural numbers)
and empty password is successfully logged in (requirement: password is 6-12 digits + letters).
The above three templates can be applied.

​The above is all the methods of software test cases, focusing on mastering equivalence classes, boundary values, decision tables, and scenario design methods, because these four are used in practice. You can look at the cause-and-effect diagram and orthogonal arrangement to know the following concepts , When writing test cases, pay special attention to the title. The title may affect the quality of your test case, and the same is true for defect cases!
 

5. A little help

The following is a complete set of information for software testing engineers that I compiled for free . I hope everyone can benefit a lot from this growth process. Improve the testing technology in an all-round way and establish a set of own technical system. Helping everyone to continuously learn and optimize the technology stack, follow up with advanced and mainstream testing technology, bring you not only the improvement of technology and salary, but also change the status and mentality of testers in the field of IT technology, and improve Test the technical depth of the industry.

 

The above information only shows a small part. There are more than 600 G of information in total. It is not realistic to show all of them. In order not to affect your reading experience, only part of the content is shown. Everyone has sorted it out, and at the same time, it also saves everyone the time of searching for information on the Internet to learn!

 


 

Guess you like

Origin blog.csdn.net/HUA1211/article/details/130388784