Presentation on theme: "Génération de jeux de test pour les programmes de règles 1 er juillet 2009 ILOG Chair of Software Engineering Freiburg Universität Bruno Berstel"— Presentation transcript:
Génération de jeux de test pour les programmes de règles 1 er juillet 2009 ILOG Chair of Software Engineering Freiburg Universität Bruno Berstel email@example.com Michel Leconte firstname.lastname@example.org
2 / 13 What does The User want? As a user: –I have a program made of a collection of rules –I usually have no specification of this program –I have to write a test suite that covers well the program I want you to: –At least generate the input data for these tests with a good coverage –If possible, also generate the expected results
3 / 13 The rules we talk about Condition-Action rules –If the value of the shopping cart is greater than 100, then give a gift to the customer. –If the subject of the mail contains enlarge your Rolex, then mark the mail as junk. Made of –A condition (or guard): a formula with variables on an object model –An action part: assignments, calls to methods of the object model –Object model = graph of objects with attributes Not a tree: beware of aliasing
4 / 13 What does it mean to test a rule? And furthermore to generate tests for a rule?
5 / 13 A test for one rule A rule is a relation –between input states and output states –partial, as the rule may not be executable in some states A test case for a rule is –an initial state (input data) –whether the rule is expected to be executable –if so, the expected resulting state (output data)
6 / 13 Generating tests for one rule To find an initial state where the rule is executable: –Build a logical formula from the rule guard –Solve the satisfiability of this formula We use a constraint solver Plus preferences to choose among multiple solutions Are we interested in states where the rule is not executable? –If so, solve the satisfiability of the negation of the guard Probably interested in exploring all disjuncts –To be addressed with respect to the other rules.
7 / 13 What does it mean to test a rule program? And furthermore to generate tests for a rule program?
8 / 13 Whats the difference? Gold 35 y.o. Gold 65 y.o. Silver 65 y.o. if the customer category is Gold, then… if the customer age is greater than 60, then… r1 r2 r1r1 r2r2
9 / 13 A test suite that covers well… In absence of overlapping rules –generate one test case for each rule –optionally several cases for each rule if it reassures the user a test for the case where no rule is applicable A simple approach to overlaps –disambiguate overlaps –generate one test for each case
10 / 13 Its not enough Gold 35 y.o. Gold 65 y.o. Silver 65 y.o. if the customer category is Gold, then… if the customer age is greater than 60, then… r1 r2 r1r1 r2r2 ? s1s1 s2s2 s3s3
11 / 13 General approach Consider the rule combinations and their maximal executions –either as transitions –or as executions –or as execution histories These combinations do not overlap (when confluent) –generate one test case for each
13 / 13 Conclusion Generating one test case for one rule is easy. Generating a test suite for a rule program involves computing its executions. –Cf. bounded model checking? The concept of coverage raises the issues of overlapping and confluence. –An overlapping analysis could be helpful to start with –So could a confluence analysis
Your consent to our cookies if you continue to use this website.