Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt

Slides:



Advertisements
Similar presentations
Coverage Criteria Drawn mostly from Ammann&Offutt and Pezze&Yooung.
Advertisements

1 Applications of Optimization to Logic Testing Gary Kaminski and Paul Ammann ICST 2010 CSTVA Workshop.
Course Software Testing & Verification 2013/14 Wishnu Prasetya
Software Testing Logic Coverage. Introduction to Software Testing (Ch 3) © Ammann & Offutt 2 Logic Coverage Four Structures for Modeling Software Graphs.
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt
Logic ChAPTER 3 1. Truth Tables and Validity of Arguments
Examples Simplify: ab’c + abc + a’bc Show that X + X’Y = X + Y
Give qualifications of instructors: DAP
EE1J2 – Discrete Maths Lecture 5
Introduction to Software Testing Chapter 3.1 Logic Coverage Paul Ammann & Jeff Offutt.
ECE 331 – Digital System Design Karnaugh Maps and Determining a Minimal Cover (Lecture #7) The slides included herein were taken from the materials accompanying.
Introduction to Software Testing Chapter 8.2
Homework 3.
3.2 – Truth Tables and Equivalent Statements
Logic ChAPTER 3.
Of 33 Improving Logic-Based Testing Jeff Offutt Professor, Software Engineering George Mason University Fairfax, VA USA
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Chapter 1 The Logic of Compound Statements. Section 1.1 Logical Form and Logical Equivalence.
Today’s Agenda  Quick Review  Finish Graph-Based Testing  Predicate Testing Software Testing and Maintenance 1.
1 Simplification of Boolean Functions:  An implementation of a Boolean Function requires the use of logic gates.  A smaller number of gates, with each.
Department of Computer Engineering
Probabilistic graphical models. Graphical models are a marriage between probability theory and graph theory (Michael Jordan, 1998) A compact representation.
Software Logic Mutation Testing Presented by Gary Kaminski.
Introduction to Software Testing Chapter 8.1 Logic Coverage Paul Ammann & Jeff Offutt
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt
Examples. Examples (1/11)  Example #1: f(A,B,C,D) =  m(2,3,4,5,7,8,10,13,15) Fill in the 1’s. 1 1 C A B CD AB D 1 1.
3.3: Truth Tables. Types of Statements Negation: ~p Conjunction: p ˄ q (p and q) Disjunction: p V q (p or q, or both) Conditional: p → q (if p, then q)
07 KM Page 1 ECEn/CS 224 Karnaugh Maps. 07 KM Page 2 ECEn/CS 224 What are Karnaugh Maps? A simpler way to handle most (but not all) jobs of manipulating.
CHAPTER 3: PRINCIPLES OF COMBINATIONAL LOGIC
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt
Chapter 7 Logic, Sets, and Counting
Warmup Answer the following True/False questions in your head: I have brown hair AND I am wearing glasses I am male OR I am wearing sneakers I am NOT male.
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
Introduction to Software Testing Chapter 8.1 Logic Coverage Paul Ammann & Jeff Offutt
Boolean Logic.
Using Logic Criterion Feasibility to Reduce Test Set Size While Guaranteeing Double Fault Detection Gary Kaminski and Paul Ammann Software Engineering.
Notes - Truth Tables fun, fun, and more fun!!!!. A compound statement is created by combining two or more statements, p and q.
Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1 Logic Coverage Paul Ammann & Jeff Offutt.
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
C.S.Choy39 TERMINOLOGY Minterm –product term containing all input variables of a function in either true or complementary form Maxterm – sum term containing.
Digital Logic (Karnaugh Map). Karnaugh Maps Karnaugh maps (K-maps) are graphical representations of boolean functions. One map cell corresponds to a row.
MATH 110 Sec 12-1 Lecture: Intro to Counting Introduction to Counting: Just how many are there?
Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ.
1 Using a Fault Hierarchy to Improve the Efficiency of DNF Logic Mutation Testing Gary Kaminski and Paul Ammann ICST 2009.
Introduction to Software Testing Chapter 3.2 Logic Coverage
ECE 301 – Digital Electronics Minimizing Boolean Expressions using K-maps, The Minimal Cover, and Incompletely Specified Boolean Functions (Lecture #6)
Introduction to Software Testing Chapter 3.4 Logic Coverage for Specifications Paul Ammann & Jeff Offutt
Using Logic Criterion Feasibility to Reduce Test Set Size While Guaranteeing Fault Detection Gary Kaminski and Paul Ammann ICST 2009 March 24 Version.
Test #2 Practice MGF 1106 Summer 2011.
Introduction to Software Testing Chapter 8.2
Introduction to Software Testing Chapter 8.1 Logic Coverage
Paul Ammann & Jeff Offutt
Introduction to Software Testing Syntactic Logic Coverage Criteria
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage
Logic Coverage CS 4501 / 6501 Software Testing
Optimized Implementation of Logic Function
Digital Logic & Design Dr. Waseem Ikram Lecture 12.
CHAPTER 5 KARNAUGH MAPS 5.1 Minimum Forms of Switching Functions
Introduction to Software Testing Chapter 3.2 Logic Coverage
Logic Coverage CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Logic Coverage for Source Code CS 4501 / 6501 Software Testing
[Ammann and Offutt, “Introduction to Software Testing,” Ch. 8]
Introduction to Software Testing Chapter 8.1 Logic Coverage
Introduction to Software Testing Chapter 3.2 Logic Coverage
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage
Presentation transcript:

Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt

Disjunctive Normal Form Common Representation for Boolean Functions –Slightly Different Notation for Operators –Slightly Different Terminology Basics: –A literal is a clause or the negation (overstrike) of a clause Examples: a, a –A term is a set of literals connected by logical “and” “and” is denoted by adjacency instead of  Examples: ab, ab, ab for a  b, a  ¬ b, ¬ a  ¬ b –A (disjunctive normal form) predicate is a set of terms connected by “or” “or” is denoted by + instead of  Examples: abc + ab + ac Terms are also called “implicants” –If a term is true, that implies the predicate is true Introduction to Software Testing (Ch 3) 2 © Ammann & Offutt

Implicant Coverage Obvious coverage idea: Make each implicant evaluate to “true”. –Problem: Only tests “true” cases for the predicate. –Solution: Include DNF representations for negation. Implicant Coverage (IC) : Given DNF representations of a predicate f and its negation f, for each implicant in f and f, TR contains the requirement that the implicant evaluate to true. Example: f = ab + bc f = b + ac Implicants: { ab, bc, b, ac } Possible test set: {TTF, FFT} Observation: IC is relatively weak Introduction to Software Testing (Ch 3) 3 © Ammann & Offutt

Improving on Implicant Coverage Additional Definitions: –A proper subterm is a term with one or more clauses removed Example: abc has 6 proper subterms: a, b, c, ab, ac, bc –A prime implicant is an implicant such that no proper subterm is also an implicant. Example: f = ab + abc Implicant ab is a prime implicant Implicant abc is not a prime implicant (due to proper subterm ac) –A redundant implicant is an implicant that can be removed without changing the value of the predicate Example: f = ab + ac + bc ab is redundant Predicate can be written: ac + bc Introduction to Software Testing (Ch 3) 4 © Ammann & Offutt

Unique True Points A minimal DNF representation is one with only prime, nonredundant implicants. A unique true point with respect to a given implicant is an assignment of truth values so that –the given implicant is true, and –all other implicants are false Hence a unique true point test focuses on just one implicant A minimal representation guarantees the existence of at least one unique true point for each implicant Unique True Point Coverage (UTPC) : Given minimal DNF representations of a predicate f and its negation f, TR contains a unique true point for each implicant in f and f. Introduction to Software Testing (Ch 3) 5 © Ammann & Offutt

Unique True Point Example Consider again: f = ab + bc f = b + ac –Implicants: { ab, bc, b, ac } –Each of these implicants is prime –None of these implicants is redundant Unique true points: –ab: {TTT} –bc: {FTF} –b: {FFF, TFF, TFT} –ac: {FTT} Note: Three possible (minimal) test sets satisfying UTPC –Each test set has four tests UTPC is fairly powerful –Exponential in general, but reasonable cost for many common functions –No subsumption relation wrt any of the ACC or ICC Criteria Introduction to Software Testing (Ch 3) 6 © Ammann & Offutt

Near False Points A near false point with respect to a clause c in implicant i is an assignment of truth values such that f is false, but if c is negated (and all other clauses left as is), i (and hence f) evaluates to true. Relation to determination: at a near false point, c determines f –Hence we should expect relationship to ACC criteria Note that definition only mentions f, and not f. Clearly, CUTPNFP subsumes RACC Unique True Point and Near False Point Pair Coverage (CUTPNFP) : Given a minimal DNF representation of a predicate f, for each clause c in each implicant i, TR contains a unique true point for i and a near false point for c such that the points differ only in the truth value of c. Introduction to Software Testing (Ch 3) 7 © Ammann & Offutt

CUTPNFP Example Consider f = ab + cd –For implicant ab, we have 3 unique true points: {TTFF, TTFT, TTTF} For clause a, we can pair unique true point TTFF with near false point FTFF For clause b, we can pair unique true point TTFF with near false point TFFF –For implicant cd, we have 3 unique true points: {FFTT, FTTT, TFTT} For clause c, we can pair unique true point FFTT with near false point FFFT For clause d, we can pair unique true point FFTT with near false point FFTF CUTPNFP set: {TTFF, FFTT, TFFF, FTFF, FFTF, FFFT} –First two tests are unique true points; others are near false points Rough number of tests required: # implicants * # literals Introduction to Software Testing (Ch 3) 8 © Ammann & Offutt

DNF Fault Classes ENF: Expression Negation Faultf = ab+cf’ = ab+c TNF: Term Negation Faultf = ab+cf’ = ab+c TOF: Term Omission Faultf = ab+cf’ = ab LNF: Literal Negation Faultf = ab+cf’ = ab+c LRF: Literal Reference Faultf = ab + bcdf’ = ad + bcd LOF: Literal Omission Faultf = ab + cf’ = a + c LIF: Literal Insertion Faultf = ab + cf’ = ab + bc ORF+: Operator Reference Faultf = ab + cf’ = abc ORF*: Operator Reference Faultf = ab + cf’ = a + b + c Key idea is that fault classes are related with respect to testing: Test sets guaranteed to detect certain faults are also guaranteed to detect additional faults. Introduction to Software Testing (Ch 3) 9 © Ammann & Offutt

Fault Detection Relationships Expression Negation Fault ENF Literal Insertion Fault LIF Term Omission Fault TOF Literal Reference Fault LRF Literal Negation Fault LNF Operator Reference Fault ORF+ Literal Omission Fault LOF Term Negation Fault TNF Operator Reference Fault ORF* Introduction to Software Testing (Ch 3) 10 © Ammann & Offutt

Understanding The Detection Relationships Consider the TOF (Term Omission Fault) class –UTPC requires a unique true point for every implicant (term) –Hence UTPC detects all TOF faults –From the diagram, UTPC also detects: All LNF faults (Unique true point for implicant now false) All TNF faults (All true points for implicant are now false points) All ORF+ faults (Unique true points for joined terms now false) All ENF faults (Any single test detects this…) Although CUTPNFP does not subsume UTPC, CUTPNFP detects all fault classes that UTPC detects (Converse is false) Consider what this says about the notions of subsumption vs. fault detection Literature has many more powerful (and more expensive) DNF criteria –In particular, possible to detect entire fault hierarchy (MUMCUT) Introduction to Software Testing (Ch 3) 11 © Ammann & Offutt

Karnaugh Maps for Testing Logic Expressions Fair Warning –We use, rather than present, Karnaugh Maps –Newcomer to Karnaugh Maps probably needs a tutorial Suggestion: Google “Karnaugh Map Tutorial” Our goal: Apply Karnaugh Maps to concepts used to test logic expressions –Identify when a clause determines a predicate –Identify the negation of a predicate –Identify prime implicants and redundant implicants –Identify unique true points –Identify unique true point / near false point pairs No new material here on testing –Just fast shortcuts for concepts already presented Introduction to Software Testing (Ch 3) 12 © Ammann & Offutt

K-Map: A clause determines a predicate Consider the predicate: f = b + ac + ac Suppose we want to identify when b determines f The dashed line highlights where b changes value –If two cells joined by the dashed line have different values for f, then b determines f for those two cells. –b determines f: ac + ac (but NOT at ac or ac) Repeat for clauses a and c ttt1 ttt ab c Introduction to Software Testing (Ch 3) 13 © Ammann & Offutt

K-Map: Negation of a predicate Consider the predicate: f = ab + bc Draw the Karnaugh Map for the negation –Identify groups –Write down negation: f = b + a c tt1 t ab c tt1 ttt ab c Introduction to Software Testing (Ch 3) 14 © Ammann & Offutt

K-Map: Prime and redundant implicants Consider the predicate: f = abc + abd + abcd + abcd + acd Draw the Karnaugh Map Implicants that are not prime: abd, abcd, abcd, acd Redundant implicant: abd Prime implicants –Three: ad, bcd, abc –The last is redundant –Minimal DNF representation f = ad + bcd ab cd t t tt t t Introduction to Software Testing (Ch 3) 15 © Ammann & Offutt

K-Map: Unique True Points Consider the predicate: f = ab + cd Three unique true points for ab –TTFF, TTFT, TTTF –TTTT is a true point, but not a unique true point Three unique true points for cd –FFTT, FTTT, TFTT Unique true points for f f = ac + bc + ad + bd –FTFT,TFFT, FTTF, TFTF Possible UTPC test set –f: {TTFT, FFTT} –f: {FTFT, TFFT, FTTF, TFTF} ab cd t t tt t t t Introduction to Software Testing (Ch 3) 16 © Ammann & Offutt

Additional Material Some of the remaining slides cover material beyond what is currently in the text –CUTPNFP is covered in the text –MUMCUT (MUTP+CUTPNFP+MNFP) is not –Minimal-MUMCUT makes MUMCUT much less expensive Introduction to Software Testing (Ch 3) 17 © Ammann & Offutt

For each implicant find unique true points (UTPs) so that –Literals not in implicant take on values T and F Consider the DNF predicate: – f = ab + cd For implicant ab –Choose TTFT, TTTF For implicant cd –Choose FTTT, TFTT MUTP test set –{TTFT, TTTF, FTTT, TFTT} MUTP: Multiple Unique True Points ab cd t t tt t t t

CUTPNFP: Corresponding Unique True Point Near False Point Pairs Consider the DNF predicate: f = ab + cd For implicant ab –For a, choose UTP, NFP pair TTFF, FTFF –For b, choose UTP, NFP pair TTFT, TFFT For implicant cd –For c, choose UTP, NFP pair FFTT, FFFT –For d, choose UTP, NFP pair FFTT, FFTF Possible CUTPNFP test set –{TTFF, TTFT, FFTT //UTPs FTFF, TFFT, FFFT, FFTF} //NFPs ab cd t t tt t t t

Find NFP tests for each literal such that all literals not in the term attain F and T Consider the DNF predicate: – f = ab + cd For implicant ab –Choose FTFT, FTTF for a –Choose TFFT, TFTF for b For implicant cd –Choose FTFT, TFFT for c –Choose FTTF, TFTF for d MNFP test set –{TFTF, TFFT, FTTF, TFTF} Example is small, but generally MNFP is large MNFP: Multiple Near False Points ab cd t t tt t t t

21 Minimal-MUMCUT Criterion Kaminski/Ammann (ICST 2009) Minimal-MUMCUT uses low level criterion feasibility analysis –Adds CUTPNFP and MNFP only when necessary Minimal-MUMCUT guarantees detecting LIF, LRF, LOF –And thus all 9 faults in the hierarchy CUTPNF P feasible? MNFP Test Set = MUTP + MNFP For Each Literal In Term Test Set = MUTP + CUTPNFP MUTP feasible? Test Set = MUTP + NFP For Each Term