1. Decision Table
A decision table is a table that lists the various combinations of values and the corresponding output values of all inputs as conditions.
It is able to enumerate complex problems in all possible cases, concise and avoid omissions. Therefore, the decision table can be used to design a complete set of test cases.
Decision tables are usually composed of conditional piles (Conditions), condition items (Condition alternatives), action piles (actions), and action Entries 4 parts.
| Condition Pile |
Condition Item |
| Action Pile |
Action Item |
Condition Piles: List all possible conditions
Condition Item: Lists all possible ranges of values for conditions given by the condition pile
Action piles: List the actions to be taken
Action item: Indicates the action to be taken in the context of the various values of the condition item
2. Structure and simplification of decision tables
The <1> Construction decision table can take the following 5 steps:
(1) List all the condition piles and action piles.
(2) Determine the number of action rules (condition items).
(3) Fill in the conditions.
(4) Fill in the action item and get the initial decision table.
(5) Simplifying decision tables and merging similar rules.
Simplification of <2> decision table
For the decision table of n conditions, there are 2n rules (each with a true and false value), and when n is large, the decision table is cumbersome. When you actually use a decision table, it is often simplified first. The simplification of decision tables is the goal of merging similar rules. The even if table has more than two rules with the same action, and a very similar relationship exists between the conditional items and can be merged.
3. Use case analysis
Nextdate (int month, int day, int year) function specifies that three integers are entered: month, day, and year, and the output of the function is the date after the date entered. For example, when the input is March 7, 2006, the output of the function is March 8, 2006, and year satisfies 1920≤year≤2050.
The steps are as follows:
1) Construct decision table
M1={Month: 30 days/month},
M2={Month: 31 days/month, except December}, m3={month: December},m4={month: February} d1={Date: 1<= Day <=27}, d2={Date: Day =28}, d3={Date: Day =29}, d4={Date: Day =30}, d5={ Date: day = 31}
Y1={year: Leap year},y2={: Common year} NOTE: February: Common year 28 days, leap years 29 days conditional pile:
C1: Month in {M1,M2,M3,M4} One of the C2: date in {d1,d2,d3,d4, D5} One C3: Year in {y1,y2} One of the action piles:
A1: Impossible A2: Date increased by 1
A3: Date Reset (1) A4: Month increased by 1
A5: Month Reset (set 1) A6: Annual Increase 1
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21st |
22 |
| C1: Month |
M1 |
M1 |
M1 |
M1 |
M1 |
M2 |
M2 |
M2 |
M2 |
M2 |
M3 |
M3 |
M3 |
M3 |
M3 |
M4 |
M4 |
M4 |
M4 |
M4 |
M4 |
M4 |
| C2: Sun |
D1 |
D2 |
D3 |
D4 |
D5 |
D1 |
D2 |
D3 |
D4 |
D5 |
D1 |
D2 |
D3 |
D4 |
D5 |
D1 |
D2 |
D2 |
D3 |
D3 |
D4 |
D5 |
| C3: Year |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
y1 |
y2 |
y1 |
y2 |
|
|
| A1: Impossible |
|
|
|
& nbsp; |
√ |
|
|
|
| td>
|
|
|
|
|
|
|
|
|
√ |
√ |
√ |
| A2: Date +1 |
√ |
√ |
√ |
|
|
√ |
√ |
√ |
√ |
|
√ |
√ |
√ |
√ |
|
√ |
√ |
|
|
|
|
|
| A3: Date reset (position) |
|
|
|
√ |
|
|
|
| td>
√ |
|
|
|
|
√ |
|
|
√ |
√ |
|
|
|
| A4: Month +1 |
|
|
|
Span style= "FONT-SIZE:13PX;" >√ |
|
|
|
|
|
√ |
|
|
|
|
|
|
|
√ |
|
|
|
| A5: Month Reset (position) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
√ |
|
|
|
|
|
|
|
| A6: Year +1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
√ |
|
|
|
|
|
|
|
————————
2) The test case is designed by the decision table and the test case table. ( Simplification)
| Use Case number |
Month |
Day |
Years |
Expected output |
| 1-3 |
4 |
12/28/29 |
2001 |
April 2001 13/29/30 Day |
| 4 |
4 |
30 |
2001 |
April 5, 2001 |
| 5 |
4 |
31 |
2001 |
No way |
| 6-9 |
1 |
15/28/29/30 |
2001 |
January 2001 16/29/30/31 Day |
| 10 |
1 |
31 |
2001 |
February 1, 2001 |
| 11-14 |
12 |
15/28/29/30 |
2001 |
February 2001 16/29/30/31 Day |
| 15 |
12 |
31 |
2001 |
January 1, 2002 |
| 16 |
2 |
15 |
2001 |
February 16, 2001 |
| 17 |
2 |
28 |
2004 |
February 29, 2004 |
| 18 |
2 |
28 |
2001 |
March 1, 2001 |
| 19 |
2 |
29 |
2005 |
March 1, 2005 |
| 20 |
2 |
29 |
2001 |
No way |
| 21,22 |
2 |
30/31 |
2001 |
No way |
Black box test--Decision table method