Table of contents
1. Basic elements of a test case
1.1 Test case: unit user registration is successful
5. Granularity and evaluation of test cases
1. Basic elements of a test case
A 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.
1) The use case is clearly expressed without ambiguity2) Use cases are highly operable.3) The input and output of the use case are clear. A use case has only one expected result.4) The maintainability of use cases is good.5) The coverage rate of use cases to requirements is high,6) The ability to expose program bugs is strong.
1.1 Test case: unit user registration is successful
Step action
:
|
Expected result
:
|
Go to the registration page, select register
|
The system displays the registration page
|
Enter the unit name, unit email, password, confirmation password, organization code, verification code that meet the requirements, and confirm and agree to the "User Registration Agreement", submit the registration information
|
The system performs the registration operation and sends an activation email. After the registration is successful, jump to the registration success page and prompt the user to activate.
|
Enter the email address used for registration to activate
|
Activation successful
|
Use the registered email address and password to log in
|
Login is successful, the system displays the welcome page
|
test method
|
manual
|
importance
|
important
|
test environment
|
Chrome,IE |
test premise
|
The system is running normally and the mail server is turned on
|
functional module
|
register log in |
1.2 Comparison of test cases
Mobile camera test case
Ambiguity Use Cases | Be clear about use cases |
Title: Single Shot. (title unclear) | Title: Single Photo |
...the use case element "Test Idea" is missing | Test ideas: Check whether the whole process from pressing the shutter button to taking pictures meets the requirements, including the status of the photo indicator light, the display of the screen during the photo storage process, and the correctness check of the photos |
Preset conditions: the flash is forced to close, the battery is sufficient | Preset conditions: the flash is forced to close, the battery is sufficient |
Steps:....steps are incomplete 1) Point the lens at the subject and press the shutter button. 2) Press the page down key to browse the photos just taken |
step: 1) Aim the subject with the camera lens, and when ready, press the shutter button. 2) Pay attention to the sound of pressing the shutter button 3) During the photo saving process, observe the changes displayed on the phone screen 4) Prompt that the photo is saved successfully |
Expected output: ...the relative step has no output 1) It can be seen that the photo just taken is normal |
Expected output: 1) After pressing the shutter, the set shutter sound will be heard within one second 2) During the photo saving process, the phone screen displays the photo being saved, and the screen returns to the camera mode after the save is completed 3) The photos are what you see and what you get, and the pixels and colors of the photos are the same as the set mode. |
2. Benefits of Test Cases
1) Basis for the test executor2) Make the work repeatable, the basis of automated testing3) Evaluate Requirements Coverage4) Reuse of use cases5) Accumulate test method ideas for subsequent reference
Trouble in use:
The design of test cases is a time-consuming and laborious work, and the time spent on designing test cases is more than the time spent on execution
Solve the following problems:
I don't know if all the functions have been tested more comprehensivelyTest coverage cannot be measuredRepeated testing of new versions is difficult to implementThere are a large number of redundant tests that affect test efficiency
3. Use case design method
3.1 Requirements-based design
1 ) Verify that the requirements are correct, complete, unambiguous, and logically consistent.2 ) From the perspective of " black box " , design a sufficient and necessary test set to ensure that the design and code can fully meet the requirementsbeg.
3.2 Case
1) User needs
Purchase a smartphone, test case:
1. Price range
2. Branding options
3. Smartphone
4. Mobile phone function verification
Make calls, answer calls, send text messages, receive text messages, listen to songs...
2) Software requirements
email event flow
1. If the user has not received the activation email, he can send the activation email again after entering the email and password on the login interface.2. 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-1 . If the email is not received, enter the email and password when logging in, and then send the activation email again1-2 . The email has been received. After entering the email and password when logging in, no activation email will be sent2-1 . After receiving the email, activate it within 24 hours2-2 . After receiving the email, the link will expire after 24 hours for activation.2-3 . After receiving the email, it has been activated, and the link will expire after 24 hours, click to activate again
page check
1. Receive the activation email2. The content of the email is correct3. The activation URL is correct and can be activated4. Reactivation prompts that it has been activated5. The expired activation prompt has expired
3.3 Specific design method
equivalence class
Boundary value
causal diagram
Orthogonal arrangement
Scenario Design Method
wrong guess
3.3.1 Equivalence classes
For example, divide the students in a class into several categories: excellent, medium, general
3.3.2 Boundary values
1) The length of the input box is 1-10, and the boundary values are: 1, 10, 0, 112) Athletes’ competitions range from 1 to 4, with boundary values: 0, 1, 2, 3, 43) The query page has 999 lines, and every 50 lines is a page. Take the boundary value and output 0 lines, 50 lines, 51 lines, 999 lines
3.3.3 Causal Diagram
1) Identity
2) with
If there are only two causes, and both are true, then the effect must be true.
3) or
The effect is true when one of the two causes is true.
4) non
The effect is true only if the cause is plus
1) Analyze all possible inputs and possible outputs.2) Find out the correspondence between input and output.3) Draw a cause-and-effect diagram.4) Convert the causal diagram into a decision table.5) Correspond the decision table to each test case
Case number one:
Assume that the processing rule of the business document is: " Taobao 618 event, the bill of lading has been submitted, and the total order value is greater than 300 yuan or there is a red envelope, then enter the discount . "
1. For this business rule, first by analyzing all possible inputs and possible outputs, the following results can be obtained:
● Input: The order has been submitted, the amount is greater than 300, and there is a red envelope.● Output: Preferential, non-preferential.
2. Then, proceed to the second step to find out the correspondence between the input and the output. Through analysis, it can be seen that there are the following correspondences.
1) The order has been submitted, and the order amount is more than 300 yuan, then the discount will be given.2) The order has been submitted, the order amount is less than or equal to 300 yuan, no red envelope, no discount3) The order has been submitted, and if there is a red envelope, it will be discounted.4) The order has been submitted, the order amount is more than 300 yuan, and if there is a red envelope, the discount will be given.5) The order has not been submitted, no discount
3. In order to facilitate the drawing of the cause-and-effect diagram and the decision table, all inputs and outputs need to be numbered, and the numbers are as follows
1 : The order has been submitted.2 : The order amount is greater than 300 yuan.3 : There are red envelopes21 : Offer22 : no discount
5. Draw the decision table
There are three conditions, and the output has 2 values, so the number of columns in the table is 2*2*2 = 8
6. The final test case
Designing test cases by the causal method can help testers clarify the relationship between input and output, but for more complex input and output, it will take a lot of time
3.3.4 Orthogonal arrangement
Use orthogonal permutations when there are too many causal design use cases
The purpose of the orthogonal method is to reduce the number of use cases. Cover pairwise combinations of inputs with as few use cases as possible.
Orthogonal experimental design (Orthogonal experimental design) is a design method for studying multi-factors and multi-levels. According to the orthogonality, some representative points are selected from the combination of all levels of experimental factors for experiments. Analysis of test results Understand the situation of the comprehensive test and find out the optimal level combination.
Orthogonal test design is a high-efficiency, fast and economical test based on orthogonal tables
Factor ( Factor ): In an experiment, the variables to be investigated are called factors (variables)
1. What are the factors (variables)2. What are the levels of each factor (the value of the variable)3. Select a suitable orthogonal table4. Map the value of the variable to the table5. Take the combination of each factor level in each row as a test case6. Add combinations of use cases that you think are suspicious and do not appear in the table
case:
Take registration as an example
3. The number of factors in the table =5 ;
Number of levels to each factor number in the table = 2
Take the one with the least number of rows, that is, the one with the least number of trials
5. Supplementary test cases
3.3.5 Scenario Design Method
1. After the user activates, click the email activation link again?2. Registered users register again?
3.3.6 Error Guessing Method
1. How to deal with special characters and spaces in verification ?2. What is the case in the password verification?3. Special characters in the name?4. Whether the password is sent in plain text
4. Validity of test cases
5. Granularity and evaluation of test cases
5.1 Granularity of test cases
A good test case is a person who is not familiar with the business can quickly test according to the use case
Granularity: Refers to the level of detail in which test cases are written.
Product Quality RequirementsProject Requirements for Use CasesSufficient time and resources for testing
5.2 Evaluation of test cases
peer reviewuser checkProject team review
3) The meeting will be organized and coordinated by the person in charge of the test, the use case writer will explain the use case, and the participants will raise objections on the spot.
6. Test case
Consider the direction
|
checking point
|
Description of test ideas
|
Forward
|
Export data correctness
|
Export data and verify data correctness
|
reverse
|
Validity of exported data
|
Is the export function correct when there is no data
|
Boundary capacity
|
TF
card space is insufficient
|
Can only hold part of the data
|
Boundary capacity
|
TF
card capacity is full
|
|
fault tolerance
|
TF
card write protection
|
|
fault tolerance
|
TF
card cannot be recognized
|
|
fault tolerance
|
human interruption
|
Unplug the TF
card when exporting
|
fault tolerance
|
Power outage, shutdown, etc. while exporting
|
After restarting, check whether it can be exported correctly
|
performance
|
Export multiple times in a row
|
Script implementation, massive export, check whether the data is correct
|
performance
|
Check export speed
|
|
compatibility
|
Different brands and capacities
|
|
compatibility
|
Different partition formats
FAT, FAT32
,
NTFS
|