test case
Test case format
Use Case Number: ABCD
A : Product or project name; B : Use case attributes ( ST, IT, UT ) ; C : Customer management (new customer, what type of customer); D number
Example: CRM-ST- Customer Management - Add Customer - 001
Test item: a test case for a certain object (customer management - new customer)
Test title: Add customer information with an empty name; Add customer information with a name longer than 20 characters : Add customer information with a name containing single quotation marks
Use case attributes: functional testing; performance testing; compatibility testing; security testing;
Severity level: (in order from low to high)
High: use cases that implement the main function,
Medium: The main item process can be correctly implemented after alternative stream processing or exception handling
Low: 1GUI; 2 Ease of use expression; 3 Text description class
Operation steps : Actual operation according to the use case
Expected result : The result described in the user manual
Actual output: The actual result after the test is completed
Equivalence class:
1 A collection of things with the same properties or methods
2 The characteristics of an individual in this set are completely consistent with other personalities
3 For the test input of a test object, if an individual can be accepted or rejected, then any individual in the set of the individual should be accepted or rejected.
Equivalence class division:
Effective equivalence class: for the object under test, the input that is reasonable, meaningful, and accepted by the system
Invalid equivalence class: for an object, unreasonably meaningless input that the system cannot accept
Equivalence class division rules:
1 If the number of values of the input fields specified by the requirement or a certain range is determined, one valid equivalence class and two invalid equivalence classes can be determined (for example: valid equivalence classes [ username length is 6-18 ] . bit ] invalid equivalence class [ username length greater than 18 digits ] [ username length less than 6 digits ] )
2 If the requirement specifies a set of input fields, or how it must be, a valid equivalence class and an invalid equivalence class can be determined (for example: valid equivalence class [ starting with a letter ] invalid equivalence class [ not starting with a letter ] )
3 If the requirement specifies that an input field is a true or false value, a valid equivalence class and an invalid equivalence class can be determined
4 If user requirements specify a set of values for the input field, several valid equivalence classes and one invalid equivalence class can be determined
Design a use case:
1 According to the needs, divide the valid and invalid equivalence classes, the valid equivalence classes are uniformly numbered, and the invalid equivalence classes are uniformly numbered
2 Design a new test case to cover as much as possible all valid equivalence classes that have not been covered until all valid equivalence classes are covered
3 Design a new test case to cover only one invalid equivalence class until all invalid equivalence classes are covered
Equivalence Class Four Algorithms:
Add: Without considering other sub-items of the demand, break down the current test points and the most accumulated detailed requirements in detail
Reduce: reduce according to business rules, exclude relevant impossible rules, and reduce impossible combinations
Multiplication: If there are requirements with mutually exclusive conditions in the effective equivalence class, multiplication can be performed to obtain the number of use cases
Except: Exclude all equivalence classes with duplicate characteristics, try to make the intersection between valid equivalence classes empty, and the intersection between invalid equivalence classes is also empty, and the union of valid and invalid equivalence classes is the entire input area
Boundary value: (Example: Username length is 6-18 digits )
Three points of boundary value: upper point [ point on boundary value ( 6,18)]; distance point [ ①point closest to upper point ( 5,19 ) ②determined according to the accuracy of upper point ]; inner point [ boundary value Any point in the valid range ( 10, 15 , etc. )] ;
How to determine the departure point [ ① If the boundary value is a closed interval, the departure point is outside ( the length of the user name is between (6, 18) , then the upper point 6,18; the departure point 7, 17; the inner point 10) ② If the boundary If the value is an open interval, then the off point is included ( the length of the user name is between [ 6,18 ] , then the upper point is 6,18 ; the off point 5,19 ) ] ;
Boundary value application scenarios:
1 If the requirement specifies the value range or the number of values, the data within and near the boundary of the range can be used for testing ; for example [ 6,18 ] On point 6,18 , point 5,19 point 10
2 If the requirement specifies the number of values to be taken, then one less than one, or one more than one value is tested; for example, if you buy 5 items, you will get a 20 % discount. The test data is: 4 items, 5 items, 6 items
3 If the requirement specifies an ordered set, the first and last box values of the set can be used for testing ; for example: there are four city names in the drop-down list, which are now available for selection, and the test data is the first city name and last city name
If the program uses an internal data structure, it should be considered from the boundaries of the data structure
Steps to apply the boundary value method:
1 According to the equivalence class method, divide the valid and invalid equivalence classes, determine the upper point, the departure point and the inner point, and each point is numbered uniformly
2 Design a new test case to cover as much as possible all valid equivalence classes that have not been covered until all valid equivalence classes are fully covered
3 Design a new test case to cover only one invalid equivalence class until all invalid equivalence classes are fully covered
Judgment table
definition:
1 A tool for analyzing and expressing a number of input conditions, the corresponding tool made by the measured object for these inputs
2 When encountering complex logic business, you can use this table to clarify the relationship of business logic
Important concepts:
1 condition
① Condition pile: All inputs of the measured object defined by the requirements specification
②Condition item: true and false values of all possible data data for the condition pile
2 actions
① Action pile: All actions that may be taken by the conditional object under test
②Action item: for the action pile, the corresponding possible value of the measured object
3 Rules: Action items and condition items are combined to form business logic processing rules
Steps to apply the judgment table:
1 Understand the requirements and determine the condition piles and action piles
2 Design and optimization judgment table
3 Fill in the action items
4 According to the performance of the output results in the judgment table, merge the judgment tables ( not necessary ) , and simplify the judgment table: if the output is the same, in its corresponding input, there is only one conditional value that does not have any effect on the action, then it can be merge
5 Extract test cases
cause and effect diagram
1 Fishbone Diagram
2 The relationship between input and input
①Different : At most one of the input conditions will be generated, or one may not
②Or : Among all input conditions, at least one occurs, or more, or all
③Unique : Among all input conditions, there is one and only one condition occurs
④Requirement : All input conditions, as long as one occurs, the others will also appear
The relationship of the input domain output:
①Identity : ( 1 ) When the input condition occurs, the result must appear ( 2 ) When the input condition does not occur, the result must not appear
②Non : ( 1 ) When the input condition occurs, the result must not appear ( 2 ) When the input condition does not occur, the result must appear
③And : When there are multiple input conditions, the result will only appear if all input conditions occur
④Or : When multiple input conditions, as long as one occurs, the result will appear
Orthogonal test
1 factor: all the conditions involved in the experiment that affect the result of the experiment become factors
2 levels: the value or input of the factor affecting the experiment becomes the level
3 Neat and comparable: In the same orthogonal table, the number of occurrences of each new evaluation of each factor is exactly the same, and in the experiment, each new evaluation of each factor has the same probability of participating in the experiment with the level of other factors
4 Uniform dispersion: In the same orthogonal table, the horizontal collocation of any two columns is exactly the same
5 Design Process
①Analyze demand acquisition factors and levels
②Select the appropriate orthogonal table according to the factor level
③Replace factor levels to obtain the number of trials
④According to experience, the number of tests will be supplemented by other factors
⑤ Refine the output to obtain test cases
important point
① When selecting an orthogonal table, the factors and levels are exactly the same as the orthogonal table
② When the number of words in the measured object factor is different from that in the orthogonal table, select the factor in the orthogonal table that is slightly larger than the number of measured object factors, and the number of tests is the least, and the redundant factors are discarded.
③The level of the measured object is different from the level in the orthogonal table, which can be combined according to the actual situation and then split
④ If the levels of the factors are not the same, you can choose the factor whose level is slightly larger than that of the tested object and has the least number of trials.
state transition
Pay attention to the state change of the object under test, whether there is an unreachable state and an illegal state in the requirements specification, and whether an illegal state transition occurs
State: the response state that the object under test maintains under certain input conditions
Method flow:
1 Define the status node according to the requirements
2 Draw a state transition diagram
3 Drawing the state transition tree
4 Extract test cases
test analysis
1 Scene design method:
Three processes: ①Basic flow: All inputs are correct through the business process, and the process can finally achieve the goal (for example: ATM withdrawal: insert bank card, enter password, enter withdrawal amount, withdraw money, withdraw card)
②Alternative flow: When implementing the business process, due to wrong operation or abnormal input, the process is repeated, but the desired business process can finally be completed (for example: ATM withdrawal : insert a bank card, enter the password [the first error, the first error The second time is correct], enter the withdrawal amount, withdraw money, and withdraw the card)
③ Abnormal flow: When implementing the business process, due to wrong operation or abnormal input, the business is not completed correctly (for example: ATM withdrawal: insert the bank card, enter the password [wrong three times] swallow the card)
How to use :
①Understand the requirements and determine the business process (basic flow, alternative flow, abnormal flow)
②Draw a flow chart to clarify the flow path again
③ According to the business flow chart , extract the test path (each path needs to contain a path that has never been traveled)
④ Refine the path and set up test cases
Note : It is necessary to use methods such as equivalence classes , boundary values, orthogonal tests, decision tables, and cause-and-effect diagrams to ensure the correctness of a single function