Download presentation
Presentation is loading. Please wait.
Published byEvan Wood Modified over 9 years ago
1
Truth Table-Based Testing Generating test cases when the test model is a truth table Reading: Binder Chapter 6
2
Example truth table Variant Number Normal PressureCall For HeatDamper ShutManual ModeIgnition Enable ABCDZ 000000 100010 200100 300110 401000 501010 601100 701110 810000 910011 1010100 1110111 1211001 1311011 1411100 1511111
3
Deriving the Logic Function Review boolean algebra AB = A and B A+B = A or B ~A = not A A logic function maps n boolean input variables to a boolean output variable A truth table is an enumeration of all possible input and output values
4
Logic function The logic function for the example is Z = AB~C + AD Several techniques to derive it Karnaugh maps Cause-effect graphs A compact logic function will produce more powerful test cases
5
Truth table approaches All-Variants: Every variant is tested once. The number of tests is 2 N, infeasible for large tables All-True: All variants that produce a true outcome are tested Inappropriate if false actions are an important part of the behaviour All-False: All variants that produce a false outcome are tested Inappropriate if true actions are important
6
Each-Condition/All-conditions Assumption: For the logic functions X=PQR and Y=P+Q+R, the only relevant cases are: PQRX 0110 1010 1100 1111 PQRY 0011 0101 1001 0000
7
Each-Condition/All-conditions For a logic function such as Z = AB~C + AD we apply the heuristic to every term Test cases for AB~C ABCD 010X 100X 111X 110X Test cases for AD ABCD 1XX0 0XX1 1XX1
8
Each-Condition/All-conditions The number of tests increases linearly with the number of product terms Values need to be assigned to the Don’t Care variables. Can be done randomly or by suspicion. Try different combinations for different test cases
9
Binary Decision Diagrams Compact representation of a truth table Can be used to create test suite A BDD can be generated from the truth table Start by drawing the full decision tree A left branch represents False (0) A right branch represents True (1)
10
Decision tree for boiler example
11
Reduction process Working from left to right, replace leaf nodes with equivalent constants or variables and prune the branches This way we can prune the entire left branch of the tree since it only depends on the value of A
12
First Reduction
13
Second Reduction
14
Final Binary Decision Diagram
15
BDD determinant table A BDD determinant is a root-to-leaf- path in the BDD The BDD determinant table has one row per path VariantABCDZ 10XXX0 210XDD 3111DD 4110X1
16
Test suite generation All combinations of sensitive variables, e.g. D, are created VariantABCDZ 10XXX0 210X00 210X11 311100 311111 4110X1
17
Variable Negation Strategy Designed to reveal faults that hide in a don’t care The test suite contains: Unique true points: A variant per term t, so that t is True and all other terms are False Near False Points: A variant for each literal in a term. The variant is obtained by negating the literal and is selected only if it makes Z=0 Each variant creates a test candidate set Unique true point candidate sets in boiler example: {12} {9,11,15}
18
Example truth table Variant Number Normal PressureCall For HeatDamper ShutManual ModeIgnition Enable ABCDZ 000000 100010 200100 300110 401000 501010 601100 701110 810000 910011 1010100 1110111 1211001 1311011 1411100 1511111
19
Negation variants Candidate set number Term negation Variants containing this negation Variants containing this negation where Z=0 2ABC14,1514 3A~B~C8,98 4~AB~C4,5 6A~D8,10,12,148,10,14 7~AD1,3,5,7
20
Selecting the test cases At least one variant from each candidate set Can be done by inspection Random selection is also used Near False Points exercise combinations of don’t care values 6% of all possible tests are created 98% of simulated bugs can be found
21
Test suite Candidate sets 12 14 8 4,5 9,11,15 8,10,14 1,3,5,7 Minimum Test suite 5 8 9 12 14
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.