SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Mutation Testing
  Hernán Wilkinson             Nicolás Chillo     Gabriel Brunstein
     UBA - 10Pines                  UBA                 UBA
hernan.wilkinson@gmail.com
                             nchillo@gmail.com   gaboto@gmail.com
What is Mutation Testing?



Technique to verify the quality of the tests
What is Mutation Testing?

        Verify Quality of…           Verify Quality of…




Source Code                  Tests                   Mutation
                                                     Testing
How does it work?
     1st Step: Create the Mutant

                    Mutation
                    Process




The Source
   Code                                The “Mutant”




             The Mutation “Operator”
Examples
DebitCard>>= anotherDebitCard
 ^(type = anotherDebitCard type)
  and: [ number = anotherDebitCard number ]



                   Operator: Change #and: by #or:




CreditCard>>= anotherDebitCard
 ^(type = anotherDebitCard type)
   or: [ number = anotherDebitCard number ]
Examples
Purchase>>netPaid
 ^self totalPaid – self totalRefunded



                       Change #- with #+



Purchase>>netPaid
 ^self totalPaid + self totalRefunded
Why?
How does it help?
How does it work?
  2nd Step: Try to Kill the Mutant




                                  A Killer
  The “Mutant”           tries to kill the Mutant!


All tests run  The Mutant Survives!!!
                                                     The Test Suite
A test fails or errors  The Mutant Dies
Meaning…


The Mutant Survives  The case generated by the mutant
                     is not tested



The Mutant Dies  The case generated by the mutant is
                       tested
Example: The mutant survives
DebitCard>>= anotherDebitCard
 ^(type = anotherDebitCard type) and: [ number = anotherDebitCard number ]


                                             Operator: Change #and: by #or:

DebitCard>>= anotherDebitCard
 ^(type = anotherDebitCard type) or: [ number = anotherDebitCard number ]




DebitCardTest>>testDebitCardWithSameNumberShouldBeEqual
    self assert: (DebitCard visaNumbered: 123) = (DebitCard visaNumbered: 123).
Example: The mutant dies
DebitCard>>= anotherDebitCard
 ^(type = anotherDebitCard type) and: [ number = anotherDebitCard number ]


                                             Operator: Change #and: by #or:

DebitCard>>= anotherDebitCard
 ^(type = anotherDebitCard type) or: [ number = anotherDebitCard number ]




DebitCardTest>>testDebitCardWithSameNumberShouldBeEqual
    self assert: (DebitCard visaNumbered: 123) = (DebitCard visaNumbered: 123).


DebitCardTest >>testDebitCardWithDifferentNumberShouldBeDifferent
    self deny: (DebitCard visaNumbered: 123) = (DebitCard visaNumbered: 789).
Example: The mutant survives
Purchase>>netPaid
 ^self totalPaid – self totalRefunded

                                           Change #- with #+
Purchase>>netPaid
 ^self totalPaid + self totalRefunded


Purchase>>testNetPaid
   | purchase |
   purchase := Purchase for: 20 * euros.
   self assert: purchase netPaid = (purchase totalPaid – purchase totalRefunded)
Example: The mutant dies
Purchase>>netPaid
 ^self totalPaid – self totalRefunded

                                        Change #- with #+
Purchase>>netPaid
 ^self totalPaid + self totalRefunded


Purchase>>testNetPaidWithOutRefunds  Renamed!
   | purchase |
   purchase := Purchase for: 20 * euros.
   self assert: purchase netPaid = (purchase totalPaid – purchase totalRefunded)

Purchase>>testNetPaidWithRefunds
   | purchase |
   purchase := Purchase for: 20 * euros.
   purchase addRefundFor: 10 * euros.
   self assert: purchase netPaid = (purchase totalPaid – purchase totalRefunded)
How does it work? - Summary
• Changes the original source code with
  special “operators” to generate “Mutants”
• Run the test suite related to the changed
  code
  • If a test errors or fails  Kills the mutant
  • If all tests run  The Mutant survives
• Surviving Mutants show not tested cases


                 The Important Thing!
MuTalk



Mutation Testing Tool for Smalltalk (Pharo
              and Squeak)
Demo
MuTalk – How does it work?
•       Runs the test to be sure that all run
•       For each method m
    •       For each operator o
        •     Changes m AST using o
        •     Compiles mutated code
        •     Changes method dictionary
        •     Run the tests
MuTalk – Operators
•       Boolean messages
    •    Remove #not
    •    Replace #and: with #eqv:
    •    Replace #and: with #nand:
    •    Replace #and: with #or:
    •    Replace #and: with #secondArgResult:
    •    Replace #and: with false
    •    Replace #or: First Condition with false
    •    Replace #or: Second Condition with false
    •    Replace #or: with #and:
    •    Replace #or: with #xor:
MuTalk – Operators
•       Magnitude messages
    •    Replace #'<=' with #<
    •    Replace #'<=' with #=
    •    Replace #'<=' with #>
    •    Replace #'>=' with #=
    •    Replace #'>=' with #>
    •    Replace #'~=' with #=
    •    Replace #< with #>
    •    Replace #= with #'~='
    •    Replace #> with #<
    •    Replace #max: with #min:
    •    Replace #min: with #max:
MuTalk – Operators
•       Collection messages
    •     Remove at:ifAbsent:
    •     Replace #reject: with #select:
    •     Replace #select: with #reject:
    •     Replace Reject block with [:each | false]
    •     Replace Reject block with [:each | true]
    •     Replace Select block with [:each | false]
    •     Replace Select block with [:each | true]
    •     Replace detect: block with [:each | false] when #detect:ifNone:
    •     Replace detect: block with [:each | true] when #detect:ifNone:
    •     Replace do block with [:each |]
    •     Replace ifNone: block with [] when #detect:ifNone:
    •     Replace inject:aValue into:aBlock with aValue
    •     Replace sortBlock:aBlock with sortBlock:[:a :b| true]
MuTalk – Operators
•       Number messages
    •    Replace #* with #/
    •    Replace #+ with #-
    •    Replace #- with #+
    •    Replace #/ with #*
MuTalk – Operators
•       Flow control messages
    •     Remove Exception Handler Operator
    •     Replace #ifFalse: receiver with false
    •     Replace #ifFalse: receiver with true
    •     Replace #ifFalse: with #ifTrue:
    •     Replace #ifFalse:IfTrue: receiver with false
    •     Replace #ifFalse:IfTrue: receiver with true
    •     Replace #ifTrue: receiver with false
    •     Replace #ifTrue: receiver with true
    •     Replace #ifTrue: with #ifFalse:
    •     Replace #ifTrue:ifFalse: receiver with false
    •     Replace #ifTrue:ifFalse: receiver with true
Why is not widely used?
Is not new … - History

Begins in 1971, R. Lipton, “Fault Diagnosis of
            Computer Programs”

 Generally accepted in 1978, R. Lipton et al,
  “Hints on test data selection: Help for the
           practicing programmer”
Why is not widely used?


Maturity Problem: Because Testing is not
            widely used YET!
        (Although it is increasing)
Why is not widely used?


Integration Problem: Inability to successfully
  integrate it into the software development
                     process
         (TDD plays a key role now)
Why is not widely used?



Technical Problem: It is a Brute Force
             technique!
Technical Problems
• Brute force technique



                   NxM
      N = number of tests
      M = number of mutants
Aconcagua
•   Number of Tests: 666
•   Number of Mutants: 1005
•   Time to create a mutant/compile/link/run:
    10 secs. each aprox.?
•   Total time:
     –   6693300 seconds
     –   1859 hours, 15 minutes
Another way of doing it…
CreditCard>>= anotherCreditCard
 ^(anotherCreditCard isKindOf: self class) and: [ number =
  anotherCreditCard number ]


CreditCard>>= anotherCreditCard
 MutantId = 12 ifTrue: [ ^(anotherCreditCard isKindOf: self class) or: [
  number = anotherCreditCard number ].
 MutantId = 13 ifTrue: [ ^(anotherCreditCard isKindOf: self class)
  nand: [ number = anotherCreditCard number ].
 MutantId = 14 ifTrue: [ ^(anotherCreditCard isKindOf: self class) eqv: [
  number = anotherCreditCard number ].
Aconcagua
•   Number of Tests: 666
•   Number of Mutants: 1005
•   Time to create the
    metamutant/compile/link: 2 minutes?
•   Time to run the tests per mutant: 1 sec
•   Total time:
     –   1125 seconds
     –   18 minutes 45 seconds
MuTalk Optimizations
              Running Strategies
Mutate all methods, run all tests per       Mutate covered methods, run all
     mutant                                      tests per mutant
    –    Create a mutant for each method         –      Takes coverage running all tests
    –    Run all the test for each mutant        –      Mutate only covered methods
    –    Disadvantage: Slower strategy           –      Run all methods per mutant
                                                 –      Relies on coverage

Mutate all methods, run only test           Mutate covered methods, run only test
     that cover mutated method                    that covered mutated methods
    –    Run coverage keeping for each       –       Run coverage keeping for each
         method the tests that covered it            method the tests that covered it
    –    Create a mutant for each method     –       Create a mutant for only covered
    –    For each mutant, run only the               methods
         tests that covered the original     –       For each mutant, run only the tests
         method                                      that covered the original method
MuTalk - Aconcagua Statistics
•       Mutate All, Run All: 1 minute, 6 seconds
•       Mutate Covered, Run Covering: 36
        seconds
•       Result:
    •     545 Killed
    •     6 Terminated
    •     83 Survived
More Statistics
MuTalk Optimizations
Terminated Mutants




       Try to kill the Mutant!

       The killer has to be
       “Terminated”

                                 The Test Suite
MuTalk - Terminated Mutants


• Take the time it runs each test the first
  time
• If the test takes more thant 3 times,
  terminate it
Let’s redefine MuTalk as…

  Mutation Testing Tool for Smalltalk (Pharo
  and Squeak) that uses meta-facilities to
run faster and provide inmediate feedback
Work in progress


• Operators Categorization based on how
  useful they are to detect errors
• Filter Operators on View
• Cancel process
Future work

• Make Operators more “inteligent”
  • a = b ifTrue: [ … ]
    • a = b ifFalse: [] is equivalent to a ~= b ifTrue: []
• Suggest tests using not killed mutants
• Use MuTalk to test MuTalk?
Why does it work?


 “Complex faults are coupled to simple faults
in such a way that a test data set that detects
all simple faults in a program will detect most
       complex faults” (Coupling effect)
    Demonstrated in 1995, K. Wah, “Fault coupling in finite
                                      bijective functions”
Why does it work?


 “In practice, if the software contains a fault,
there will usually be a set of mutants that can
only be killed by a test case that also detects
                     that fault”
     Geist et al, “Estimation and enhancement of real-time
      software reliability through mutation analysis”, 1992
More Statistics…
How does it compare to
               coverage?
•       Does not replaces coverage because
        some methods do not generate mutants
•       But:
    •     Mutants on not covered methods will survive
    •     It provides better insight than coverage
    •     Method Coverage fails with long
          methods/conditions/loops/etc.
Questions?
MuTalk - Mutation
    Testing for Smalltalk

  Hernán Wilkinson             Nicolás Chillo     Gabriel Brunstein
     UBA - 10Pines                  UBA                 UBA
hernan.wilkinson@gmail.com
                             nchillo@gmail.com   gaboto@gmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

Loom Virtual Threads in the JDK 19
Loom Virtual Threads in the JDK 19Loom Virtual Threads in the JDK 19
Loom Virtual Threads in the JDK 19José Paumard
 
Software testing & Quality Assurance
Software testing & Quality Assurance Software testing & Quality Assurance
Software testing & Quality Assurance Webtech Learning
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testingikhwanhayat
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | EdurekaEdureka!
 
Test case design
Test case designTest case design
Test case design99pillar
 
Test case techniques
Test case techniquesTest case techniques
Test case techniquesPina Parmar
 
Pairwise testing
Pairwise testingPairwise testing
Pairwise testingKanoah
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 
The Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable DesignThe Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
 
Pairwise testing - Strategic test case design
Pairwise testing - Strategic test case designPairwise testing - Strategic test case design
Pairwise testing - Strategic test case designXBOSoft
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven DevelopmentJohn Blum
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and typesConfiz
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing FundamentalsChankey Pathak
 

Was ist angesagt? (20)

Loom Virtual Threads in the JDK 19
Loom Virtual Threads in the JDK 19Loom Virtual Threads in the JDK 19
Loom Virtual Threads in the JDK 19
 
Software testing
Software testing Software testing
Software testing
 
Software testing & Quality Assurance
Software testing & Quality Assurance Software testing & Quality Assurance
Software testing & Quality Assurance
 
Path Testing
Path TestingPath Testing
Path Testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Types of testing
Types of testingTypes of testing
Types of testing
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
 
SE-Testing.ppt
SE-Testing.pptSE-Testing.ppt
SE-Testing.ppt
 
Test case design
Test case designTest case design
Test case design
 
Test case techniques
Test case techniquesTest case techniques
Test case techniques
 
Pairwise testing
Pairwise testingPairwise testing
Pairwise testing
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 
The Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable DesignThe Art of Unit Testing - Towards a Testable Design
The Art of Unit Testing - Towards a Testable Design
 
Pairwise testing - Strategic test case design
Pairwise testing - Strategic test case designPairwise testing - Strategic test case design
Pairwise testing - Strategic test case design
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing Fundamentals
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

Andere mochten auch

Mutation testing
Mutation testingMutation testing
Mutation testingTao He
 
Mutation testing (OOP 2012, 2012-JAN-24)
Mutation testing (OOP 2012, 2012-JAN-24)Mutation testing (OOP 2012, 2012-JAN-24)
Mutation testing (OOP 2012, 2012-JAN-24)Filip Van Laenen
 
Mutation Testing
Mutation TestingMutation Testing
Mutation Testing10Pines
 
Kill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van RijnKill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van RijnNLJUG
 
Mutation Testing: Leaving the Stone Age. FOSDEM 2017
Mutation Testing: Leaving the Stone Age. FOSDEM 2017Mutation Testing: Leaving the Stone Age. FOSDEM 2017
Mutation Testing: Leaving the Stone Age. FOSDEM 2017Alex Denisov
 
An introduction to mutation testing
An introduction to mutation testingAn introduction to mutation testing
An introduction to mutation testingdavidmus
 
Mutagens
MutagensMutagens
MutagensUE
 
Test corner第三回, Charles 的使用經驗分享。
Test corner第三回, Charles 的使用經驗分享。Test corner第三回, Charles 的使用經驗分享。
Test corner第三回, Charles 的使用經驗分享。Su Sheng Chieh
 
Exploratory Testing Explained (Tampere Goes Agile - 2013)
Exploratory Testing Explained (Tampere Goes Agile - 2013)Exploratory Testing Explained (Tampere Goes Agile - 2013)
Exploratory Testing Explained (Tampere Goes Agile - 2013)Aleksis Tulonen
 
Exploratory Testing Explained and Experienced
Exploratory Testing Explained and ExperiencedExploratory Testing Explained and Experienced
Exploratory Testing Explained and ExperiencedMaaret Pyhäjärvi
 
Random testing
Random testingRandom testing
Random testingCan KAYA
 
xUnit Test Patterns - Chapter11
xUnit Test Patterns - Chapter11xUnit Test Patterns - Chapter11
xUnit Test Patterns - Chapter11Takuto Wada
 
Venusfx business presentations final (1)
Venusfx business presentations final (1)Venusfx business presentations final (1)
Venusfx business presentations final (1)Chandran Vellusamy
 

Andere mochten auch (20)

Mutation testing
Mutation testingMutation testing
Mutation testing
 
Mutation testing (OOP 2012, 2012-JAN-24)
Mutation testing (OOP 2012, 2012-JAN-24)Mutation testing (OOP 2012, 2012-JAN-24)
Mutation testing (OOP 2012, 2012-JAN-24)
 
Mutation Testing
Mutation TestingMutation Testing
Mutation Testing
 
Mutation testing
Mutation testingMutation testing
Mutation testing
 
Kill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van RijnKill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van Rijn
 
Mutation Testing: Leaving the Stone Age. FOSDEM 2017
Mutation Testing: Leaving the Stone Age. FOSDEM 2017Mutation Testing: Leaving the Stone Age. FOSDEM 2017
Mutation Testing: Leaving the Stone Age. FOSDEM 2017
 
An introduction to mutation testing
An introduction to mutation testingAn introduction to mutation testing
An introduction to mutation testing
 
Mutagens
MutagensMutagens
Mutagens
 
Black box
Black boxBlack box
Black box
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Test corner第三回, Charles 的使用經驗分享。
Test corner第三回, Charles 的使用經驗分享。Test corner第三回, Charles 的使用經驗分享。
Test corner第三回, Charles 的使用經驗分享。
 
Mutation Testing
Mutation TestingMutation Testing
Mutation Testing
 
Mutation testing in Java
Mutation testing in JavaMutation testing in Java
Mutation testing in Java
 
Exploratory Testing Explained (Tampere Goes Agile - 2013)
Exploratory Testing Explained (Tampere Goes Agile - 2013)Exploratory Testing Explained (Tampere Goes Agile - 2013)
Exploratory Testing Explained (Tampere Goes Agile - 2013)
 
Exploratory Testing Explained and Experienced
Exploratory Testing Explained and ExperiencedExploratory Testing Explained and Experienced
Exploratory Testing Explained and Experienced
 
A Taste of Exploratory Testing
A Taste of Exploratory TestingA Taste of Exploratory Testing
A Taste of Exploratory Testing
 
Random testing
Random testingRandom testing
Random testing
 
xUnit Test Patterns - Chapter11
xUnit Test Patterns - Chapter11xUnit Test Patterns - Chapter11
xUnit Test Patterns - Chapter11
 
Atm reconciliation manual
Atm reconciliation manualAtm reconciliation manual
Atm reconciliation manual
 
Venusfx business presentations final (1)
Venusfx business presentations final (1)Venusfx business presentations final (1)
Venusfx business presentations final (1)
 

Ähnlich wie Mutation Testing

Benchmarking and PHPBench
Benchmarking and PHPBenchBenchmarking and PHPBench
Benchmarking and PHPBenchdantleech
 
The Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can StealThe Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can Stealmozilla.presentations
 
Mutation Testing.pdf
Mutation Testing.pdfMutation Testing.pdf
Mutation Testing.pdfKeir Bowden
 
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...Steve Lange
 
EvoRobocode Competition @ GECCO-2013
EvoRobocode Competition @ GECCO-2013EvoRobocode Competition @ GECCO-2013
EvoRobocode Competition @ GECCO-2013Daniele Loiacono
 
Procedures, the Pop-11 stack and debugging
Procedures, the Pop-11 stack and debuggingProcedures, the Pop-11 stack and debugging
Procedures, the Pop-11 stack and debuggingRich Price
 
Tech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisTech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisAdaCore
 
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web AppsWeb 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web Appsadunne
 
Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...
Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...
Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...Steve Lange
 
The Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmThe Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmAndrey Karpov
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Béo Tú
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceJesse Vincent
 
Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016Gerald Muecke
 
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationStop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationSam McAfee
 
Test Smart, not hard
Test Smart, not hardTest Smart, not hard
Test Smart, not hardDiUS
 

Ähnlich wie Mutation Testing (20)

des mutants dans le code.pdf
des mutants dans le code.pdfdes mutants dans le code.pdf
des mutants dans le code.pdf
 
Benchmarking and PHPBench
Benchmarking and PHPBenchBenchmarking and PHPBench
Benchmarking and PHPBench
 
The Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can StealThe Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can Steal
 
Mutation Testing.pdf
Mutation Testing.pdfMutation Testing.pdf
Mutation Testing.pdf
 
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
 
EvoRobocode Competition @ GECCO-2013
EvoRobocode Competition @ GECCO-2013EvoRobocode Competition @ GECCO-2013
EvoRobocode Competition @ GECCO-2013
 
Procedures, the Pop-11 stack and debugging
Procedures, the Pop-11 stack and debuggingProcedures, the Pop-11 stack and debugging
Procedures, the Pop-11 stack and debugging
 
Mutation-Testing mit PIT
Mutation-Testing mit PITMutation-Testing mit PIT
Mutation-Testing mit PIT
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Test Automation Day 2018
Test Automation Day 2018Test Automation Day 2018
Test Automation Day 2018
 
Tech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisTech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic Analysis
 
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web AppsWeb 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web Apps
 
Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...
Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...
Session #3: "It Works on My Machine!" Closing the Loop Between Development & ...
 
TDD, BDD and mocks
TDD, BDD and mocksTDD, BDD and mocks
TDD, BDD and mocks
 
The Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmThe Unicorn's Travel to the Microcosm
The Unicorn's Travel to the Microcosm
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
 
Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016
 
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo SimulationStop Flying Blind! Quantifying Risk with Monte Carlo Simulation
Stop Flying Blind! Quantifying Risk with Monte Carlo Simulation
 
Test Smart, not hard
Test Smart, not hardTest Smart, not hard
Test Smart, not hard
 

Mehr von ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

Mehr von ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Kürzlich hochgeladen

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Kürzlich hochgeladen (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Mutation Testing

  • 1. Mutation Testing Hernán Wilkinson Nicolás Chillo Gabriel Brunstein UBA - 10Pines UBA UBA hernan.wilkinson@gmail.com nchillo@gmail.com gaboto@gmail.com
  • 2. What is Mutation Testing? Technique to verify the quality of the tests
  • 3. What is Mutation Testing? Verify Quality of… Verify Quality of… Source Code Tests Mutation Testing
  • 4. How does it work? 1st Step: Create the Mutant Mutation Process The Source Code The “Mutant” The Mutation “Operator”
  • 5. Examples DebitCard>>= anotherDebitCard ^(type = anotherDebitCard type) and: [ number = anotherDebitCard number ] Operator: Change #and: by #or: CreditCard>>= anotherDebitCard ^(type = anotherDebitCard type) or: [ number = anotherDebitCard number ]
  • 6. Examples Purchase>>netPaid ^self totalPaid – self totalRefunded Change #- with #+ Purchase>>netPaid ^self totalPaid + self totalRefunded
  • 8. How does it work? 2nd Step: Try to Kill the Mutant A Killer The “Mutant” tries to kill the Mutant! All tests run  The Mutant Survives!!! The Test Suite A test fails or errors  The Mutant Dies
  • 9. Meaning… The Mutant Survives  The case generated by the mutant is not tested The Mutant Dies  The case generated by the mutant is tested
  • 10. Example: The mutant survives DebitCard>>= anotherDebitCard ^(type = anotherDebitCard type) and: [ number = anotherDebitCard number ] Operator: Change #and: by #or: DebitCard>>= anotherDebitCard ^(type = anotherDebitCard type) or: [ number = anotherDebitCard number ] DebitCardTest>>testDebitCardWithSameNumberShouldBeEqual self assert: (DebitCard visaNumbered: 123) = (DebitCard visaNumbered: 123).
  • 11. Example: The mutant dies DebitCard>>= anotherDebitCard ^(type = anotherDebitCard type) and: [ number = anotherDebitCard number ] Operator: Change #and: by #or: DebitCard>>= anotherDebitCard ^(type = anotherDebitCard type) or: [ number = anotherDebitCard number ] DebitCardTest>>testDebitCardWithSameNumberShouldBeEqual self assert: (DebitCard visaNumbered: 123) = (DebitCard visaNumbered: 123). DebitCardTest >>testDebitCardWithDifferentNumberShouldBeDifferent self deny: (DebitCard visaNumbered: 123) = (DebitCard visaNumbered: 789).
  • 12. Example: The mutant survives Purchase>>netPaid ^self totalPaid – self totalRefunded Change #- with #+ Purchase>>netPaid ^self totalPaid + self totalRefunded Purchase>>testNetPaid | purchase | purchase := Purchase for: 20 * euros. self assert: purchase netPaid = (purchase totalPaid – purchase totalRefunded)
  • 13. Example: The mutant dies Purchase>>netPaid ^self totalPaid – self totalRefunded Change #- with #+ Purchase>>netPaid ^self totalPaid + self totalRefunded Purchase>>testNetPaidWithOutRefunds  Renamed! | purchase | purchase := Purchase for: 20 * euros. self assert: purchase netPaid = (purchase totalPaid – purchase totalRefunded) Purchase>>testNetPaidWithRefunds | purchase | purchase := Purchase for: 20 * euros. purchase addRefundFor: 10 * euros. self assert: purchase netPaid = (purchase totalPaid – purchase totalRefunded)
  • 14. How does it work? - Summary • Changes the original source code with special “operators” to generate “Mutants” • Run the test suite related to the changed code • If a test errors or fails  Kills the mutant • If all tests run  The Mutant survives • Surviving Mutants show not tested cases The Important Thing!
  • 15. MuTalk Mutation Testing Tool for Smalltalk (Pharo and Squeak)
  • 16. Demo
  • 17. MuTalk – How does it work? • Runs the test to be sure that all run • For each method m • For each operator o • Changes m AST using o • Compiles mutated code • Changes method dictionary • Run the tests
  • 18. MuTalk – Operators • Boolean messages • Remove #not • Replace #and: with #eqv: • Replace #and: with #nand: • Replace #and: with #or: • Replace #and: with #secondArgResult: • Replace #and: with false • Replace #or: First Condition with false • Replace #or: Second Condition with false • Replace #or: with #and: • Replace #or: with #xor:
  • 19. MuTalk – Operators • Magnitude messages • Replace #'<=' with #< • Replace #'<=' with #= • Replace #'<=' with #> • Replace #'>=' with #= • Replace #'>=' with #> • Replace #'~=' with #= • Replace #< with #> • Replace #= with #'~=' • Replace #> with #< • Replace #max: with #min: • Replace #min: with #max:
  • 20. MuTalk – Operators • Collection messages • Remove at:ifAbsent: • Replace #reject: with #select: • Replace #select: with #reject: • Replace Reject block with [:each | false] • Replace Reject block with [:each | true] • Replace Select block with [:each | false] • Replace Select block with [:each | true] • Replace detect: block with [:each | false] when #detect:ifNone: • Replace detect: block with [:each | true] when #detect:ifNone: • Replace do block with [:each |] • Replace ifNone: block with [] when #detect:ifNone: • Replace inject:aValue into:aBlock with aValue • Replace sortBlock:aBlock with sortBlock:[:a :b| true]
  • 21. MuTalk – Operators • Number messages • Replace #* with #/ • Replace #+ with #- • Replace #- with #+ • Replace #/ with #*
  • 22. MuTalk – Operators • Flow control messages • Remove Exception Handler Operator • Replace #ifFalse: receiver with false • Replace #ifFalse: receiver with true • Replace #ifFalse: with #ifTrue: • Replace #ifFalse:IfTrue: receiver with false • Replace #ifFalse:IfTrue: receiver with true • Replace #ifTrue: receiver with false • Replace #ifTrue: receiver with true • Replace #ifTrue: with #ifFalse: • Replace #ifTrue:ifFalse: receiver with false • Replace #ifTrue:ifFalse: receiver with true
  • 23. Why is not widely used?
  • 24. Is not new … - History Begins in 1971, R. Lipton, “Fault Diagnosis of Computer Programs” Generally accepted in 1978, R. Lipton et al, “Hints on test data selection: Help for the practicing programmer”
  • 25. Why is not widely used? Maturity Problem: Because Testing is not widely used YET! (Although it is increasing)
  • 26. Why is not widely used? Integration Problem: Inability to successfully integrate it into the software development process (TDD plays a key role now)
  • 27. Why is not widely used? Technical Problem: It is a Brute Force technique!
  • 28. Technical Problems • Brute force technique NxM N = number of tests M = number of mutants
  • 29. Aconcagua • Number of Tests: 666 • Number of Mutants: 1005 • Time to create a mutant/compile/link/run: 10 secs. each aprox.? • Total time: – 6693300 seconds – 1859 hours, 15 minutes
  • 30. Another way of doing it… CreditCard>>= anotherCreditCard ^(anotherCreditCard isKindOf: self class) and: [ number = anotherCreditCard number ] CreditCard>>= anotherCreditCard MutantId = 12 ifTrue: [ ^(anotherCreditCard isKindOf: self class) or: [ number = anotherCreditCard number ]. MutantId = 13 ifTrue: [ ^(anotherCreditCard isKindOf: self class) nand: [ number = anotherCreditCard number ]. MutantId = 14 ifTrue: [ ^(anotherCreditCard isKindOf: self class) eqv: [ number = anotherCreditCard number ].
  • 31. Aconcagua • Number of Tests: 666 • Number of Mutants: 1005 • Time to create the metamutant/compile/link: 2 minutes? • Time to run the tests per mutant: 1 sec • Total time: – 1125 seconds – 18 minutes 45 seconds
  • 32. MuTalk Optimizations Running Strategies Mutate all methods, run all tests per Mutate covered methods, run all mutant tests per mutant – Create a mutant for each method – Takes coverage running all tests – Run all the test for each mutant – Mutate only covered methods – Disadvantage: Slower strategy – Run all methods per mutant – Relies on coverage Mutate all methods, run only test Mutate covered methods, run only test that cover mutated method that covered mutated methods – Run coverage keeping for each – Run coverage keeping for each method the tests that covered it method the tests that covered it – Create a mutant for each method – Create a mutant for only covered – For each mutant, run only the methods tests that covered the original – For each mutant, run only the tests method that covered the original method
  • 33. MuTalk - Aconcagua Statistics • Mutate All, Run All: 1 minute, 6 seconds • Mutate Covered, Run Covering: 36 seconds • Result: • 545 Killed • 6 Terminated • 83 Survived
  • 35. MuTalk Optimizations Terminated Mutants Try to kill the Mutant! The killer has to be “Terminated” The Test Suite
  • 36. MuTalk - Terminated Mutants • Take the time it runs each test the first time • If the test takes more thant 3 times, terminate it
  • 37. Let’s redefine MuTalk as… Mutation Testing Tool for Smalltalk (Pharo and Squeak) that uses meta-facilities to run faster and provide inmediate feedback
  • 38. Work in progress • Operators Categorization based on how useful they are to detect errors • Filter Operators on View • Cancel process
  • 39. Future work • Make Operators more “inteligent” • a = b ifTrue: [ … ] • a = b ifFalse: [] is equivalent to a ~= b ifTrue: [] • Suggest tests using not killed mutants • Use MuTalk to test MuTalk?
  • 40. Why does it work? “Complex faults are coupled to simple faults in such a way that a test data set that detects all simple faults in a program will detect most complex faults” (Coupling effect) Demonstrated in 1995, K. Wah, “Fault coupling in finite bijective functions”
  • 41. Why does it work? “In practice, if the software contains a fault, there will usually be a set of mutants that can only be killed by a test case that also detects that fault” Geist et al, “Estimation and enhancement of real-time software reliability through mutation analysis”, 1992
  • 43. How does it compare to coverage? • Does not replaces coverage because some methods do not generate mutants • But: • Mutants on not covered methods will survive • It provides better insight than coverage • Method Coverage fails with long methods/conditions/loops/etc.
  • 45. MuTalk - Mutation Testing for Smalltalk Hernán Wilkinson Nicolás Chillo Gabriel Brunstein UBA - 10Pines UBA UBA hernan.wilkinson@gmail.com nchillo@gmail.com gaboto@gmail.com