SlideShare a Scribd company logo
Evolutionary Testing of Stateful Systems:
a Holistic Approach

Matteo Miraz                Advisor: prof. L. Baresi
Febuary 18, 2011          Coadvisor: prof. P. L. Lanzi
Motivations                                                                2




• Software systems permeate (almost) every aspect of our life
   • Software is buggy
   • In 2002 the costs related to software errors are estimated
     in 60 Billion USD




     1999: NASA Mars Climate Orbiter ($125 million)   2011: iPhone Alarm

         DEI
Motivations                                                         3




Testing is an effective technique to increase the quality of software
    Does not guarantee that the system is error-free
    Is extremely expensive, as it requires up to half of the entire
      development effort


Stringent requirements on time-to-market
limit the testing effort
• We spoke with an important software
   consultant company, with major Italian
   banks as customers…
     • The good: they save up to half of
        the entire development effort
     • The bad: they do not test anything
     • The ugly: we had to explain them
        what testing is

         DEI
Related Work                                     4




• The research community proposed several ways
  to automatically generate tests

   • Symbolic Execution
   • Search-Based Software Testing




        DEI
Symbolic Execution                                                       5




•   The program is executed with
    symbolic values as input parameters
    (instead of concrete inputs)

                                                             PC: a = 3
•   Paths are associated with a                              PC: a = 3 & log10(b) = 7
    Path Condition (PC)
     • A PC constraints symbolic
       inputs to traverse the path
     • It is created incrementally:
       at each condition a formula is
                                          PC: a = 3 & log10(b) = 7
       added to the Path Condition
                                                Constraint
                                                  solver
•   A constraint solver is used
    to find concrete inputs for PCs       toTest(3, 10 000 000)




          DEI
Search Based Software Testing: a survey                                          6




• Goal: complete branch coverage
• Paradigm “command and conquer”
    The program is analyzed
     to identify branches
    Each branch is considered
     separately from the others
                                            entry



                                      w = Math.log(b)



                                          if (a == 3)

                                           F            T

                                                            if (w == 7)

                                                            F             T

                                                                              // target



                                               exit



       DEI
Search Based Software Testing: a survey                                                                   7




Once a target has been selected
• Identify dependent branches
• Search for inputs able to reach the target
• Fitness Function:
                                             Fitness(a = 0, b = 0) =
   • Approach Level +                      1 + norm(| 0 – 3 |) = 1.003
      Normalized distance
                                                                     entry



                                                                w = Math.log(b)
   Parameters        Fitness
                                          distance: | 0 – 3 |
   a=0, b=0          1.003                                         if (a == 3)
                                         Approach Level: 1
                                                                                 T
   a=1, b=0          1.002                                          F

                                                                                     if (w == 7)
   a=3, b=0          0.999               Approach Level: 0
                                                                                     F             T
   a=4, b=0          1.001                                                                             // target

   a=3, b=10         0.005
   a=3, b=100        0.003                                              exit



          DEI
Problems of Search Based Software Testing                   8




Usage of a single guidance    Works on isolated functions
       Coarse / Misleading   Modern systems are object-oriented
 void foo(int []a) {
   int flag = 0;
   for(int i=0; i<10; i++)
     if(a[i] == 23)
       flag = 1;

     if(flag == 1) {
       // target
     }
 }




         DEI
Targeting Stateful Systems                          9




• We Target Stateful systems (e.g., Java classes)




• Feature – State Loop
   • A feature might put objects
     in “particular ” states
   • A “particular” state might




                                                        enables
     enable other features




        DEI
Our Approach: TestFul                                          10




                        An individual of the Evolutionary
                        algorithm (a Test) is a sequence of
                        constructor and method calls on the test
                        cluster (i.e., the class under test + all the
                        required dependencies)

                        We use a multi-objective EA, guided by:

                        •   The coverage of tests
                             •   Tests with a high coverage stress
                                 more deeply the class under test and
                                 put objects in more interesting states

                        •   Compactness of tests
                             •   Unnecessary long tests waste
                                 computational resources during their
                                 evaluation




      DEI
Improvements                                    11




How can we improve        How can we correctly
the efficiency?           reward tests?
• We use efficiency       • We use
  enhancement               complementary
  techniques:               coverage criteria:
  • Local Search            • Control Flow Graph
  • Seeding                 • Data Flow Graph
  • Fitness Inheritance     • Behavioral




      DEI
Local Search                                                     12




• We hybridize the evolutionary algorithm with a step of local search

   •   EA works at class level
        • Reaches complex
           state configurations

   •   Local search works on methods
        • It focuses on the easiest
           missing element
        • It adopts a simpler search
           strategy (hill climbing)

   •   Which element to improve?
        • One of the best elements
        • 5% of the population
        • 10% of the population




         DEI
Local Search                                                 13




• At each generation of the Evolutionary Algorithm,
  we pick the { 5% / 10% / best } test and we target
  the easiest branch to reach among those not
  exercised yet

                                                       target




            DEI
Local Search                                                       14




• At each generation of the Evolutionary Algorithm, we pick the { 5% /
  10% / best } test and we target the easiest branch to reach among
  those not exercised yet
• We perform a local search by using a simple algorithm (hill climbing)
   • The guidance is provided by the following fitness function:




• The result (if any) is merged in the evolutionary algorithm’s population




            DEI
Contribution of the Local Search                         15




                                    Simple Problem
                                        (Fraction)




                                   Complex Problem
                                   (Disjoint Set Fast)




       DEI
Seeding                                                                      16




• Problem:
   •   Testful starts the evolution from a population with a poor quality.
• Solution:
   •   Run an inexpensive technique (random search) for a short time,
       and use its result as initial population




         DEI
Fitness Inheritance                                                   17




• Problem:
   •   Executing tests and collecting coverage is expensive
• Solution:
   •   Evaluate the “real” fitness only on a part of the population
        • Other individuals inherit the fitness of their parents
   •   Which policy to select individuals to evaluate?
        • Uniform selection
        • Frontier selection: better tests are evaluate more often




         DEI
Improvements                                    18




How can we improve        How can we correctly
the efficiency?           reward tests?
• We use efficiency       • We use
   enhancement              complementary
   techniques:              coverage criteria:
  • Local Search            • Control Flow Graph
  • Seeding                 • Data Flow Graph
  • Fitness Inheritance     • Behavioral




      DEI
Coverage of the Control-Flow Graph                                19




Testful aims to maximize:
    The number of basic blocks executed (~ statement coverage)
    The number of branches exercised
We compared our approach against
    jAutoTest: a Java Port of Bertrand Meyer’s Random Testing Approach
    Randoop: Michael Ernst’s taboo search
    etoc: Paolo Tonella’s Evolutionary Testing of Classes
On a benchmark of classes from
                                                                   10 min
• Literature
• Known software libraries
• Independent testing benchmarks




        DEI
Coverage of the Data-Flow Graph                                             20




Fault-detection effectiveness of Statement and Branch coverage has been disputed


•   Criteria on the coverage of the Data-Flow Graph have been proposed
     • Fit well on Object-Oriented systems
     • Data dependency
          • Statements might define the value of variable (e.g., v = 10 )
          • Statements might use the value of some variables (e.g. print(v) )
               • P-Use if the use happens in a predicate (e.g. if(v == 3) )

•   TestFul leverages Data-Flow information
      Extend the fitness function with all def-use and all def-puse coverage
      Improve Local Search and solve data-dependent problems
                                                             (e.g., flag variable)
•   Tracking data-flow coverage is expensive! ()




          DEI
Coverage of the Data-Flow Graph                           21




Performed an extensive empirical evaluation between
• Java Path Finder (symbolic execution)
• Testful only guided by Control-Flow information




               The structural coverage remains high,
               in spite of the higher monitoring cost

                        TestFul outperforms JPF
               (e.g., statement coverage: 89% vs. 35%)

           The data-flow coverage increases a little,
         and its standard deviation lower significantly



         DEI
Some insights from our empirical evaluation…                 22




             «container classes are the de facto benchmark
                 for testing software with internal state»
                              [ Arcuri 2010 ]




       DEI
Some insights from our empirical evaluation…                      23




S. Mouchawrab, L. C. Briand, Y. Labiche, and M. Di Penta.
Assessing, Comparing, and Combining State Machine-Based Testing and
Structural Testing: A Series of Experiments.
IEEE Transactions on Software Engineering, 2010

         DEI
Coverage of the Behavioral Model                                      24




White-Box coverage criteria judge tests by considering the covered code
    • If we execute the code that contains an error, we’ll likely spot it!
    • What if there is a high-level problem? (e.g., a feature is missing)

Black-Box testing derives tests from the specification of the system
    • Adopts an outer perspective, is more resilient to high-level errors
    • Requires the specification of the system, often not available
    • We can both infer the behavioral model of the system, and reward
      tests according to their ability to thoroughly exercise the system




         DEI
Behavioral Coverage: Preliminary Results   25




       DEI
Conclusions and Future Work                                      26




• Contributions:
   • Search-Based Software Testing
   • Holistic Approach
   • Efficiency Enhancement Techniques
   • Complementary Coverage Criteria
   • Extensive Empirical Validation

• Most interesting research directions
   • Use more sources to seed the evolutionary algorithm
   • Consider coarse-grained tests (e.g. integration testing)
   • Consider other types of stateful systems (e.g., services)




        DEI
Thank you for the attention…
                    Questions?




    DEI

More Related Content

PPT
Basic elements of java
PDF
Querying UML Class Diagrams - FoSSaCS 2012
PPT
Face Identification for Humanoid Robot
PDF
ENVIRONMENTAL IMPACT OF SOIL AND SAND MINING: A REVIEW
PDF
Pradip's childbooks and apps illustration 2015
PDF
Nicot+scanlon es&amp;t 12_si
PPT
Своя африка
PDF
Agile Testing: Whole Team Approach
Basic elements of java
Querying UML Class Diagrams - FoSSaCS 2012
Face Identification for Humanoid Robot
ENVIRONMENTAL IMPACT OF SOIL AND SAND MINING: A REVIEW
Pradip's childbooks and apps illustration 2015
Nicot+scanlon es&amp;t 12_si
Своя африка
Agile Testing: Whole Team Approach

Viewers also liked (6)

PDF
Begin with Risk in Mind
PPTX
Image ratio discovery
PPTX
Smart quotations
PPTX
The role of Human Resources Management in Today's business Environment
PPT
Perang hunain
PPTX
Bill 132: What You Need to Know
Begin with Risk in Mind
Image ratio discovery
Smart quotations
The role of Human Resources Management in Today's business Environment
Perang hunain
Bill 132: What You Need to Know
Ad

Similar to Evolutionary Testing of Stateful Systems: a Holistic Approach (20)

PDF
Introducing LCS to Digital Design Verification
PPTX
CEC'10: Improving Evolutionary Testing by Means of Efficiency Enhancement Tec...
PPT
Unit 6
PDF
ICST11.ppt
PDF
Transferring Software Testing Tools to Practice (AST 2017 Keynote)
PDF
Evolutionary Testing Approach for Solving Path- Oriented Multivariate Problems
PDF
White-Box Software Testing using Evolutionary Algorithms
PPT
Testing
PPTX
Transferring Software Testing and Analytics Tools to Practice
PDF
On the value of stochastic analysis for software engineering
PPT
Functionality testing techniqu
PPT
Testing foundations
PDF
Scalable Software Testing and Verification of Non-Functional Properties throu...
PPT
testing(2).pptjjsieieo2i33kejjskskosowwiwk
PPTX
Tdd pecha kucha_v2
PPTX
Software quality assurance,eTesting.pptx
PDF
The business case for automated software engineering
PDF
IPA Fall Days 2019
PDF
Modeling XCS in class imbalances: Population sizing and parameter settings
PPT
Quality Assurance
Introducing LCS to Digital Design Verification
CEC'10: Improving Evolutionary Testing by Means of Efficiency Enhancement Tec...
Unit 6
ICST11.ppt
Transferring Software Testing Tools to Practice (AST 2017 Keynote)
Evolutionary Testing Approach for Solving Path- Oriented Multivariate Problems
White-Box Software Testing using Evolutionary Algorithms
Testing
Transferring Software Testing and Analytics Tools to Practice
On the value of stochastic analysis for software engineering
Functionality testing techniqu
Testing foundations
Scalable Software Testing and Verification of Non-Functional Properties throu...
testing(2).pptjjsieieo2i33kejjskskosowwiwk
Tdd pecha kucha_v2
Software quality assurance,eTesting.pptx
The business case for automated software engineering
IPA Fall Days 2019
Modeling XCS in class imbalances: Population sizing and parameter settings
Quality Assurance
Ad

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
A Presentation on Artificial Intelligence
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
Unlocking AI with Model Context Protocol (MCP)
cuic standard and advanced reporting.pdf
NewMind AI Monthly Chronicles - July 2025
A Presentation on Artificial Intelligence
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
Per capita expenditure prediction using model stacking based on satellite ima...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
CIFDAQ's Market Insight: SEC Turns Pro Crypto

Evolutionary Testing of Stateful Systems: a Holistic Approach

  • 1. Evolutionary Testing of Stateful Systems: a Holistic Approach Matteo Miraz Advisor: prof. L. Baresi Febuary 18, 2011 Coadvisor: prof. P. L. Lanzi
  • 2. Motivations 2 • Software systems permeate (almost) every aspect of our life • Software is buggy • In 2002 the costs related to software errors are estimated in 60 Billion USD 1999: NASA Mars Climate Orbiter ($125 million) 2011: iPhone Alarm DEI
  • 3. Motivations 3 Testing is an effective technique to increase the quality of software  Does not guarantee that the system is error-free  Is extremely expensive, as it requires up to half of the entire development effort Stringent requirements on time-to-market limit the testing effort • We spoke with an important software consultant company, with major Italian banks as customers… • The good: they save up to half of the entire development effort • The bad: they do not test anything • The ugly: we had to explain them what testing is DEI
  • 4. Related Work 4 • The research community proposed several ways to automatically generate tests • Symbolic Execution • Search-Based Software Testing DEI
  • 5. Symbolic Execution 5 • The program is executed with symbolic values as input parameters (instead of concrete inputs) PC: a = 3 • Paths are associated with a PC: a = 3 & log10(b) = 7 Path Condition (PC) • A PC constraints symbolic inputs to traverse the path • It is created incrementally: at each condition a formula is PC: a = 3 & log10(b) = 7 added to the Path Condition Constraint solver • A constraint solver is used to find concrete inputs for PCs toTest(3, 10 000 000) DEI
  • 6. Search Based Software Testing: a survey 6 • Goal: complete branch coverage • Paradigm “command and conquer”  The program is analyzed to identify branches  Each branch is considered separately from the others entry w = Math.log(b) if (a == 3) F T if (w == 7) F T // target exit DEI
  • 7. Search Based Software Testing: a survey 7 Once a target has been selected • Identify dependent branches • Search for inputs able to reach the target • Fitness Function: Fitness(a = 0, b = 0) = • Approach Level + 1 + norm(| 0 – 3 |) = 1.003 Normalized distance entry w = Math.log(b) Parameters Fitness distance: | 0 – 3 | a=0, b=0 1.003 if (a == 3) Approach Level: 1 T a=1, b=0 1.002 F if (w == 7) a=3, b=0 0.999 Approach Level: 0 F T a=4, b=0 1.001 // target a=3, b=10 0.005 a=3, b=100 0.003 exit DEI
  • 8. Problems of Search Based Software Testing 8 Usage of a single guidance Works on isolated functions Coarse / Misleading Modern systems are object-oriented void foo(int []a) { int flag = 0; for(int i=0; i<10; i++) if(a[i] == 23) flag = 1; if(flag == 1) { // target } } DEI
  • 9. Targeting Stateful Systems 9 • We Target Stateful systems (e.g., Java classes) • Feature – State Loop • A feature might put objects in “particular ” states • A “particular” state might enables enable other features DEI
  • 10. Our Approach: TestFul 10 An individual of the Evolutionary algorithm (a Test) is a sequence of constructor and method calls on the test cluster (i.e., the class under test + all the required dependencies) We use a multi-objective EA, guided by: • The coverage of tests • Tests with a high coverage stress more deeply the class under test and put objects in more interesting states • Compactness of tests • Unnecessary long tests waste computational resources during their evaluation DEI
  • 11. Improvements 11 How can we improve How can we correctly the efficiency? reward tests? • We use efficiency • We use enhancement complementary techniques: coverage criteria: • Local Search • Control Flow Graph • Seeding • Data Flow Graph • Fitness Inheritance • Behavioral DEI
  • 12. Local Search 12 • We hybridize the evolutionary algorithm with a step of local search • EA works at class level • Reaches complex state configurations • Local search works on methods • It focuses on the easiest missing element • It adopts a simpler search strategy (hill climbing) • Which element to improve? • One of the best elements • 5% of the population • 10% of the population DEI
  • 13. Local Search 13 • At each generation of the Evolutionary Algorithm, we pick the { 5% / 10% / best } test and we target the easiest branch to reach among those not exercised yet target DEI
  • 14. Local Search 14 • At each generation of the Evolutionary Algorithm, we pick the { 5% / 10% / best } test and we target the easiest branch to reach among those not exercised yet • We perform a local search by using a simple algorithm (hill climbing) • The guidance is provided by the following fitness function: • The result (if any) is merged in the evolutionary algorithm’s population DEI
  • 15. Contribution of the Local Search 15 Simple Problem (Fraction) Complex Problem (Disjoint Set Fast) DEI
  • 16. Seeding 16 • Problem: • Testful starts the evolution from a population with a poor quality. • Solution: • Run an inexpensive technique (random search) for a short time, and use its result as initial population DEI
  • 17. Fitness Inheritance 17 • Problem: • Executing tests and collecting coverage is expensive • Solution: • Evaluate the “real” fitness only on a part of the population • Other individuals inherit the fitness of their parents • Which policy to select individuals to evaluate? • Uniform selection • Frontier selection: better tests are evaluate more often DEI
  • 18. Improvements 18 How can we improve How can we correctly the efficiency? reward tests? • We use efficiency • We use enhancement complementary techniques: coverage criteria: • Local Search • Control Flow Graph • Seeding • Data Flow Graph • Fitness Inheritance • Behavioral DEI
  • 19. Coverage of the Control-Flow Graph 19 Testful aims to maximize:  The number of basic blocks executed (~ statement coverage)  The number of branches exercised We compared our approach against  jAutoTest: a Java Port of Bertrand Meyer’s Random Testing Approach  Randoop: Michael Ernst’s taboo search  etoc: Paolo Tonella’s Evolutionary Testing of Classes On a benchmark of classes from 10 min • Literature • Known software libraries • Independent testing benchmarks DEI
  • 20. Coverage of the Data-Flow Graph 20 Fault-detection effectiveness of Statement and Branch coverage has been disputed • Criteria on the coverage of the Data-Flow Graph have been proposed • Fit well on Object-Oriented systems • Data dependency • Statements might define the value of variable (e.g., v = 10 ) • Statements might use the value of some variables (e.g. print(v) ) • P-Use if the use happens in a predicate (e.g. if(v == 3) ) • TestFul leverages Data-Flow information  Extend the fitness function with all def-use and all def-puse coverage  Improve Local Search and solve data-dependent problems (e.g., flag variable) • Tracking data-flow coverage is expensive! () DEI
  • 21. Coverage of the Data-Flow Graph 21 Performed an extensive empirical evaluation between • Java Path Finder (symbolic execution) • Testful only guided by Control-Flow information The structural coverage remains high, in spite of the higher monitoring cost TestFul outperforms JPF (e.g., statement coverage: 89% vs. 35%) The data-flow coverage increases a little, and its standard deviation lower significantly DEI
  • 22. Some insights from our empirical evaluation… 22 «container classes are the de facto benchmark for testing software with internal state» [ Arcuri 2010 ] DEI
  • 23. Some insights from our empirical evaluation… 23 S. Mouchawrab, L. C. Briand, Y. Labiche, and M. Di Penta. Assessing, Comparing, and Combining State Machine-Based Testing and Structural Testing: A Series of Experiments. IEEE Transactions on Software Engineering, 2010 DEI
  • 24. Coverage of the Behavioral Model 24 White-Box coverage criteria judge tests by considering the covered code • If we execute the code that contains an error, we’ll likely spot it! • What if there is a high-level problem? (e.g., a feature is missing) Black-Box testing derives tests from the specification of the system • Adopts an outer perspective, is more resilient to high-level errors • Requires the specification of the system, often not available • We can both infer the behavioral model of the system, and reward tests according to their ability to thoroughly exercise the system DEI
  • 26. Conclusions and Future Work 26 • Contributions: • Search-Based Software Testing • Holistic Approach • Efficiency Enhancement Techniques • Complementary Coverage Criteria • Extensive Empirical Validation • Most interesting research directions • Use more sources to seed the evolutionary algorithm • Consider coarse-grained tests (e.g. integration testing) • Consider other types of stateful systems (e.g., services) DEI
  • 27. Thank you for the attention… Questions? DEI