Causality Diagram Method of Software Test Case Design Method

basic concept

The cause-and-effect diagram is a method for designing test cases by analyzing various combinations of inputs by graphical method, which is suitable for checking various combinations of program input conditions.

Steps to Design a Test Case

  1. In the description of the analysis software specification, which are the causes (that is, the input conditions or the equivalent classes of the input conditions), which are the results (that is, the output conditions), and assign an identifier to each cause and result.
  2. Analyze the semantics in the software specification description, find out the corresponding relationship between cause and effect, and between cause and cause, and draw a cause-and-effect diagram based on these relationships.
  3. Due to grammatical or environmental constraints, some combinations between causes and causes and between causes and effects cannot occur. To indicate these special situations, some symbols are used to indicate constraints or restrictions on the cause-effect diagram.
  4. Convert the cause-and-effect diagram into a decision table.
  5. Take each column of the judgment table as a basis to design test cases.

required knowledge

The relationship between cause and effect
(NOT, AND, OR, NAND, NOR, identity)
is identity: if the cause is true, then the effect must be true.
For example: if the zoo brings giant pandas, there must be giant pandas in the zoo

And: only two reasons are true, then the result is true
For example: girls in Beijing must have a car and a house

Or: the effect is true when one of the two causes is true.
For example: Miss Changsha, do you have a car or a house?

Not: The effect is true only if the cause is false.
Example: You don’t study hard to find a good job

The relationship between reasons and causes
Each reason cannot be true at the same time, but it can be false at the same time
(for example: Xiao Ming is not a student in class 11, nor is he a student in class 12)

Example 1

There is a vending machine software that handles boxed drinks with a unit price of 1 yuan and 5 cents. If you put in 1 yuan and 50 cents coins, press the "Coke", "Sprite" and "Black Tea" buttons, and the corresponding drinks will be delivered. If the input is a two-yuan coin, the 50-cent coin will be refunded when the drink is delivered.
Reasons: ① put in 1 yuan and 50 cents coins; ② put in 2 yuan coins; ③ press the "Coke" button; ④ press the "Sprite" button; ⑤ press the "Black Tea" button.
Intermediate state: ① Coin has been inserted; ② Button has been pressed.
Result: ① 5 cents will be refunded; ② "Coke" drink will be sent out; ③ "Sprite" drink will be sent out; ④ "Black Tea" drink will be sent out.
 

Example 2

There is a beverage vending machine with a unit price of 5 cents. The design specification of the software test case is as follows: Just send it out; if there is no change in the vending machine, a red light showing 〖Change Ended〗is on. At this time, after putting in a 1 yuan coin and pressing the button, the drink will not be delivered and the 1 yuan coin will be withdrawn; if there is If change is found, the red light showing 〖Change Completed〗is off, and the 5 cents coin will be refunded at the same time as the drink is delivered. "

Analysis:
Combination of Conditions, Applying a Cause-Effect Diagram

  • conditional pile
  • Put in 5 jiao c1
  • Invest 1 yuan c2
  • press orange juice c3
  • press beer c4
  • If you have change, find c5
  • no change for c6
  • action pile
  • The red light of [Change found] is off, 50 cents will be refunded, and orange juice e1 will be given away
  • The red light of [Change found] is off, 50 cents will be refunded, and beer e2 will be sent out
  • The red light of [Change found] is off, and orange juice e3 is delivered
  • The red light of [Change found] is off, and beer e4 is sent out
  • The red light of [Change found] is on, 1 yuan is withdrawn, and the drink is not delivered e5

summary

  • step
    1. Analyze input and output conditions (determine causality)
    2. Draw a causal diagram
    3. Decision table (analysis, simplification)
    4. derived test case
  • core points
    • conditions and rules
  • scope of application
    • Combinations for various conditions
  • limitation
    • software scale
    • order of conditions

 

Guess you like

Origin blog.csdn.net/MXB1220/article/details/132286034