210 likes | 355 Views
Using query checking to generate test sequences. Maryam Rashidian January, 2004. Why use query checking to generate test sequences?. Testing is our tool to uncover errors Test sets Coverage criteria Statement coverage Branch coverage Logical Expression coverage … Test requirements
E N D
Using query checking to generate test sequences Maryam Rashidian January, 2004
Why use query checking to generate test sequences? • Testing is our tool to uncover errors • Test sets • Coverage criteria • Statement coverage • Branch coverage • Logical Expression coverage • … • Test requirements • Manual construction vs. automatic generation
Using model checking to generate test sequences • Counterexamples • Trap properties • Another alternative …
Temporal logic queries • What is a query? • A query is an expression obtained by replacing a single atomic proposition in a temporal logic formula by the symbol ?x, which is referred to as the placeholder of the query. • Examples: AG(?x), EF(?x p) • What is the solution to the query? • A propositional formula is a solution to a query , relative to state s of Kripke structure K, if K,s ⊨ []. • Restricting atomic propositions • Example: AG(?x{p,q}) • Using queries with multiple placeholders • Example: EF(?x{cc} EX?y{cc}) • What is a witness? • A path through the model that explains why the solution is as computed.
query TLQ CTL SMV model (With fairness) CTL Check engine Solution + Witness/ counter-example Witness query witness KEGVis TLQSolver
SCR requirements model • Four Variable Model
SCR Constructs • Mode class • Mode • Term • Condition • Event • Input event: @T or @F • Conditioned event: @T(c) WHEN d
SCR tables • Condition table • Event table • Mode transition table
Case study: Cruise Control System • SCR requirements model for CCS • Modeling CCS with SMV • Finding queries for Logical Expression coverage criteria
SCR requirements model for CCS • SCR constructs • Monitored variables • Ignition • Brake • Accel • Button • Speed • Mode class • CC • Off, Inactive, Cruise, Override • Controlled variable • Throttle
SCR requirements … • SCR tables • Mode transition table for CC
SCR requirements … • SCR tables • Event table for controlled variable Throttle
Modeling CCS with SMV • Variable definition • Implementing mode class • Implementing controlled variable Throttle • Environmental assumptions 47 next(CC) := case 48 CC=Off & (!(Ignition) & (next(Ignition))) : Inactive; 49 CC=Inactive & ((Ignition) & !(next(Ignition))) : Off; 50 CC=Inactive & Ignition & Running & !(Toofast) & !(Brake) & !(Accel) & (!(Button = b_Cruise) & (next(Button) = b_Cruise)) : Cruise; 51 CC=Cruise & ((Ignition) & !(next(Ignition))) : Off; 52 CC=Cruise & (!(Toofast) & (next(Toofast))) : Inactive; 53 CC=Cruise & ((Running) & !(next(Running))) : Inactive; 54 CC=Cruise & (!(Brake) & (next(Brake))) : Override; 55 CC=Cruise & (!(Accel) & (next(Accel))) : Override; 56 CC=Cruise & (!(Button = b_Off) & (next(Button) = b_Off)) : Override; 57 CC=Override & ((Ignition) & !(next(Ignition))) : Off; 58 CC=Override & Ignition & ((Running) & !(next(Running))) : Inactive; 59 CC=Override & Ignition & Running & !(Brake) & !(Accel) & !(Toofast) & (!(Button = b_Resume) & (next(Button) = b_Resume)) : Cruise; 60 CC=Override & Ignition & Running & !(Brake) & !(Accel) & !(Toofast) & (!(Button = b_Cruise) & (next(Button) = b_Cruise)) : Cruise; 61 1 : CC; 62 esac;
Finding queries for Logical Expression coverage criteria • Logical Expression coverage building • Find predicates and clauses • Find test sequences for: • Predicate Coverage (PC) • Clause Coverage (CC) • General Active Clause Coverage (GACC) • Correlated Active Clause Coverage (CACC) • Restricted Active Clause Coverage (RACC)
Predicate Coverage (PC) • Two requirements • Predicate should evaluate to TRUE • Predicate should evaluate to FALSE
Query checker limitations • Do not accept Integer variables. • Do not accept more than 4 or 5 placeholders, based on the type of the variable.
Thank you Questions and Answers