SATEL Semi Automatic TEsting Language University of Geneva Levi Lúcio, Didier Buchs M-TOOS, Portland 3/18/2016 Presentation Plan CO-OPN and testing; Semi-automatic test selection; Concepts of SATEL; How do we find tests with SATEL; Conclusions. Portland, 3/18/2016 2 Presentation Plan CO-OPN and testing; Semi-automatic test selection; Concepts of SATEL; How do we find tests with SATEL; Conclusions. Portland, 3/18/2016 3 CO-OPN Specification Language Method Gate QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture. Algebraic Data Petri Net Type (ADT) CO-OPN Class Account (extended) Portland, 3/18/2016 4 Transactional Semantics and Concurrency Concurrency is automatically managed by Petri Nets… QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture. A transaction is either possible or the state of the system is not changed! Synchronization operators: Sim (//), Seq (..), Alt (+) Portland, 3/18/2016 5 Quic kTime™ and a TIFF (LZW) decompress or are needed to see this pic ture. CO-OPN Specs as Models for Testing CO-OPN specs may be seen as reactive systems: Stimulations: method events Observations: method success and gate events (may be absent…) We can extend these notions to: Stimulations: simple or synchronized method events Observations: simple or synchronized gate events Portland, 3/18/2016 6 Test Representation A Test is a graph of Stimulation / Observation pairs with a truth value; The graphs are expressed in Hennessy-Milner (HML) temporal logic: Sequence Negation Conjunction Portland, 3/18/2016 QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture. 7 QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture. Presentation Plan CO-OPN and testing; Semi-automatic test selection; Concepts of SATEL; How do we find tests with SATEL; Conclusions. Portland, 3/18/2016 8 Why is our Test Selection Semi-Automatic? The test engineer employs her semantic knowledge of the SUT to manually: Select execution paths to test (HML formulas); Select the shape of stimulation/observation synchronizations; Constrain parameters of stimulation/observation pairs. … and automatically find method parameters that correspond to equivalence classes of the method’s behavior Portland, 3/18/2016 9 Test Selection Process “Automatic” selection “Manual” selection QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture. Portland, 3/18/2016 10 Presentation Plan CO-OPN and testing; Semi-automatic test selection; Concepts of SATEL; How do we find tests with SATEL; Conclusions. Portland, 3/18/2016 11 What are Test Intentions? 3x Test Intention 2 A test intention selects a part of the model’s transition system and abstracts it… Test Intention 1 Portland, 3/18/2016 12 Writing Test Intentions A SATEL test intention is defined by axioms with constrained variables: Parameters of methods or gates ADT types or Class types Stimulations Observations HML formulas A test intention “produces” a test set! Portland, 3/18/2016 13 Language Features Test intentions described by axioms with constraints over variables; Recursion for describing repetitive paths in the labeled transition system; Reuse of test intentions for test composition. Portland, 3/18/2016 14 Axiom Structure hmlFormula in intention cond1 & cond2 & … condn => hmlFormula in intention Variables obs : observation usr : username (ADT) Axioms NonAlgebraic constrained variables condition Select one valuepossible for “usr”values per assume all their constraining the usr variable Behavior of the login operation => = true => (usrsubUniformity(usr) into jean::luc::[]) HML(<loginUser(usr) with with obs>obs> T> in login ; HML(<login(usr) in HML(<loginUser(usr) with obs> T) login; in login; Portland, 3/18/2016 15 All constraints over variables ADT Algebraic conditions defined by term equalities uniformity subuniformity Class Types Observations / Stimulations Equalities between object onlySimultaneity identifiers uniformity subuniformity HML Formulas bool depth int onlySequence bool int onlyAlternative bool simpleEvent nbSynchronizations bool int nbEvents nbOccurrences (of a method) sequence positive trace onlyConstructor onlyMutator onlyObserver uniformity subuniformity uniformity subuniformity “Automatic” constraining predicate Portland, 3/18/2016 16 int bool bool bool bool bool bool Presentation Plan CO-OPN and testing; Semi-automatic test selection; Concepts of SATEL; How do we find tests with SATEL; Conclusions. Portland, 3/18/2016 17 How to find tests For each test intention: For each axiom find the set of variable substitutions that makes the condition true 1. 2. Except variables marked with subuniformity Generate per axiom a set of partially instantiated HML formulas Portland, 3/18/2016 18 How do we find tests (2) 3. Validate the partially instantiated tests through the Spec’s transition system to find values for the remaining variables… withdraw(m):(b >= m) => balance b -> balance bm Algebraic condition allowing the on Appying a subuniformity Petri net predicate pre-condition Petri netmpost-condition implies at each method to fire fire of the withdraw calculating one m for each equation: (b >= m) = true (b >= m) = false Portland, 3/18/2016 Calculated through logic programming… 19 Presentation Plan CO-OPN and testing; Semi-automatic test selection; Concepts of SATEL; How do we find tests with SATEL; Conclusions. Portland, 3/18/2016 20 Conclusions The technique allows model based test generation; The test engineer specifies customized reusable test intentions; Abstractions from the transition system are performed automatically! Work in progress… Portland, 3/18/2016 21 Recursive Axioms and Test Intention Reuse Several axioms may exist for one test intention and they may be recursive: Variables f : HML [] in nWrongPins; Base case for the recursion Recursive definition (empty test intention) f in nWrongPins => f . HML(<login(newUser(mario)) with errorLogin> T) in nWrongPins; Axioms may be reused in other test intentions: f in nWrongPins & nbEvents(f) < 4 => f in 4LessWrongPins Test intention Condition reuse over HML formula Portland, 3/18/2016 22 “Automatic” Constraints subUniformity(usr) => HML(<login(usr) with obs> in login; During the transition induced by the “login” method select one value for “usr” per behavior of the login operation; This depends on the behavioral axioms defining the method! Portland, 3/18/2016 23