SlideShare a Scribd company logo
Test Amplification in Python
An Industrial Experience Report
Prof. Serge Demeyer
Guest lecture, Mälardalens Universitet, Västerås, Sweden
October2022
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Testing
2
Program
Under
Test
Input
Expected output
Software Testing is the process of executing a program or system with
the intent of finding errors.
(Myers, Glenford J., The art of software testing. Wiley, 1979
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Coverage
3
Program
Under
Test
Input Expected output
(mutation)
coverage
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Test Amplification
4
Program
Under
Test
Input Expected output
(mutation)
coverage
+coverage
Extra Input
Extra Input
+Extra Input +Extra output
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Example - testDeposit
5
1 def testDeposit (self) :
2 self.b.set_owner(’Iwena Kroka’)
3 self.b.deposit(10)
4 self.assertEqual(self.b.get_balance(), 10)
5 self.b.deposit(100)
6 self.b.deposit(100)
7 self.assertEqual(self.b.get_balance() , 210)
I
n
p
u
t
Expected
output
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Example - testDeposit_amplified (1/2)
6
1 def testDeposit_amplified (self) :
2 self.b.set_owner(’Iwena Kroka’)
3 self.b.deposit(10)
4 self.assertEqual(self.b.
5 get_transactions(), [10])
6 self.assertFalse(self.b.is_empty () )
7 self.assertEqual(self.b.owner, ’Iwena Kroka’)
8 self.assertEqual(self.b.get_balance(), 10)
…
Assertion
Am
plification
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Example - testDeposit_amplified (2/2)
7
1 def testDeposit_amplified (self) :
2 self.b.set_owner(’Iwena Kroka’)
3 self.b.deposit(10)
4 self.assertEqual(self.b.
5 get_transactions(), [10])
6 self.assertFalse(self.b.is_empty () )
7 self.assertEqual(self.b.owner, ’Iwena Kroka’)
8 self.assertEqual(self.b.get_balance(), 10)
9 with self.assertRaises(Exception):
10 self.b.deposit(−56313)
11 self.b.deposit(100)
12 self.b.set_owner(’Guido van Rossum’)
13 self.assertEqual(self.b.
14 get_transactions(), [10])
…
Input Am
plification
Guest Lecture - Mälardalens Universitet © Serge Demeyer
AmPyfier Engineering
8
AmPyfier: Test amplification in Python
Journal of Software Evolution and Process 2022
https://doi.org/10.1002/smr.2490
Guest Lecture - Mälardalens Universitet © Serge Demeyer
AmPyfier: Validation
9
Strengthened
37
out of 54
test classes
Guest Lecture - Mälardalens Universitet © Serge Demeyer
SmallAmp: Validation
10
Strengthened
86
out of 156
test classes
11 pull requests
8 merged
3 pending
Data
The planner
AI
       Test Amplification in Python — An Industrial Experience Report
       Test Amplification in Python — An Industrial Experience Report
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Python Project
15
20%
80%
Project
Test Suite
• Start-up established in 2020
• Fast-growing
- more customers
- more investors
- Single variant
• AI engine is vital
(Unit) Tests
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Data Driven Test Amplification
16
Amplification operators must manipulate .csv files
import ampyfier
@ampyfier.amplify_csv ( "CSVPATH" )
def test_something(amp_file="something.csv"):
...
360 minutes
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Experimental Set-Up
18
Daily
Ampyfier executes
tests on main
branch
Weekly
Ampyfier
generates new
tests
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Initial Amplification
19
Improvement for 13/25 files
• Mutation Score: 20.29%
• Code Coverage: 41.39%
Guest Lecture - Mälardalens Universitet © Serge Demeyer
Continuous Amplification
20
Improvement for all
• Mutation score: 7/8 ≈ 87%
• Code coverage: 5/8 ≈ 63%
• Both: 4/8 ≈ 50%
       Test Amplification in Python — An Industrial Experience Report

More Related Content

PDF
VST2022SmallAmpAmpyfier.pdf
PDF
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
PDF
Testing in Django
PDF
MT_01_unittest_python.pdf
PDF
Next Level Testing
PDF
DSR Testing (Part 1)
PDF
Python Testing Fundamentals
PDF
Mutation testing (OOP 2012, 2012-JAN-24)
VST2022SmallAmpAmpyfier.pdf
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Testing in Django
MT_01_unittest_python.pdf
Next Level Testing
DSR Testing (Part 1)
Python Testing Fundamentals
Mutation testing (OOP 2012, 2012-JAN-24)

Similar to Test Amplification in Python — An Industrial Experience Report (20)

PPTX
Coursbjjhuihiuyiyiyuyuiyiuyoilidnes.pptx
PPTX
Machine learning testing survey, landscapes and horizons, the Cliff Notes
PDF
How to fake_properly
PPTX
Python: Object-Oriented Testing (Unit Testing)
PDF
Making Your Own Static Analyzer Using Freud DSL. Marat Vyshegorodtsev
PPTX
Workshop: Unit Testing in Python
DOC
Testing survey by_directions
PDF
Unit Testing in Python
PDF
Reproducible Crashes: Fuzzing Pharo by Mutating the Test Methods
PDF
Stamp breizhcamp 2019
PDF
The CI as a partner for test improvement suggestions
PPT
Fundamentals of Software Engineering
PDF
Test Driven Development in Python
PDF
Debug - MITX60012016-V005100
PDF
Effective testing with pytest
PDF
Testing in the World of Functional Programming
PDF
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
PPTX
Metamorphic Testing Thesis Defense.pptx
PDF
Software Testing Project: Testing csmap program
PDF
Testing in those hard to reach places
 
Coursbjjhuihiuyiyiyuyuiyiuyoilidnes.pptx
Machine learning testing survey, landscapes and horizons, the Cliff Notes
How to fake_properly
Python: Object-Oriented Testing (Unit Testing)
Making Your Own Static Analyzer Using Freud DSL. Marat Vyshegorodtsev
Workshop: Unit Testing in Python
Testing survey by_directions
Unit Testing in Python
Reproducible Crashes: Fuzzing Pharo by Mutating the Test Methods
Stamp breizhcamp 2019
The CI as a partner for test improvement suggestions
Fundamentals of Software Engineering
Test Driven Development in Python
Debug - MITX60012016-V005100
Effective testing with pytest
Testing in the World of Functional Programming
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
Metamorphic Testing Thesis Defense.pptx
Software Testing Project: Testing csmap program
Testing in those hard to reach places
 
Ad

More from University of Antwerp (11)

PDF
"In Silico" Research: Software Engineering to the Rescue
PDF
Research Methods in Computer Science and Software Engineering
PDF
MUT4SLX: Extensions for Mutation Testing of Stateflow Models
PDF
AI For Software Engineering: Two Industrial Experience Reports
PDF
Technical Debt in Start-ups / Scale-Ups
PDF
Social Coding Platforms Facilitate Variant Forks
PDF
Formal Verification of Developer Tests: a Research Agenda Inspired by Mutatio...
PDF
Finding Bugs, Fixing Bugs, Preventing Bugs — Exploiting Automated Tests to In...
PDF
Test Automation Maturity: A Self-Assessment Tool
PDF
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
PDF
Saner open steeringcommittee2018campobassodoubleblind
"In Silico" Research: Software Engineering to the Rescue
Research Methods in Computer Science and Software Engineering
MUT4SLX: Extensions for Mutation Testing of Stateflow Models
AI For Software Engineering: Two Industrial Experience Reports
Technical Debt in Start-ups / Scale-Ups
Social Coding Platforms Facilitate Variant Forks
Formal Verification of Developer Tests: a Research Agenda Inspired by Mutatio...
Finding Bugs, Fixing Bugs, Preventing Bugs — Exploiting Automated Tests to In...
Test Automation Maturity: A Self-Assessment Tool
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
Saner open steeringcommittee2018campobassodoubleblind
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
medical staffing services at VALiNTRY
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Nekopoi APK 2025 free lastest update
PDF
Understanding Forklifts - TECH EHS Solution
PDF
System and Network Administration Chapter 2
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Cost to Outsource Software Development in 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Digital Strategies for Manufacturing Companies
PDF
Designing Intelligence for the Shop Floor.pdf
PTS Company Brochure 2025 (1).pdf.......
L1 - Introduction to python Backend.pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Digital Systems & Binary Numbers (comprehensive )
Which alternative to Crystal Reports is best for small or large businesses.pdf
top salesforce developer skills in 2025.pdf
medical staffing services at VALiNTRY
Operating system designcfffgfgggggggvggggggggg
CHAPTER 2 - PM Management and IT Context
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Nekopoi APK 2025 free lastest update
Understanding Forklifts - TECH EHS Solution
System and Network Administration Chapter 2
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo Companies in India – Driving Business Transformation.pdf
Cost to Outsource Software Development in 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
How to Choose the Right IT Partner for Your Business in Malaysia
Digital Strategies for Manufacturing Companies
Designing Intelligence for the Shop Floor.pdf

Test Amplification in Python — An Industrial Experience Report

  • 1. Test Amplification in Python An Industrial Experience Report Prof. Serge Demeyer Guest lecture, Mälardalens Universitet, Västerås, Sweden October2022
  • 2. Guest Lecture - Mälardalens Universitet © Serge Demeyer Testing 2 Program Under Test Input Expected output Software Testing is the process of executing a program or system with the intent of finding errors. (Myers, Glenford J., The art of software testing. Wiley, 1979
  • 3. Guest Lecture - Mälardalens Universitet © Serge Demeyer Coverage 3 Program Under Test Input Expected output (mutation) coverage
  • 4. Guest Lecture - Mälardalens Universitet © Serge Demeyer Test Amplification 4 Program Under Test Input Expected output (mutation) coverage +coverage Extra Input Extra Input +Extra Input +Extra output
  • 5. Guest Lecture - Mälardalens Universitet © Serge Demeyer Example - testDeposit 5 1 def testDeposit (self) : 2 self.b.set_owner(’Iwena Kroka’) 3 self.b.deposit(10) 4 self.assertEqual(self.b.get_balance(), 10) 5 self.b.deposit(100) 6 self.b.deposit(100) 7 self.assertEqual(self.b.get_balance() , 210) I n p u t Expected output
  • 6. Guest Lecture - Mälardalens Universitet © Serge Demeyer Example - testDeposit_amplified (1/2) 6 1 def testDeposit_amplified (self) : 2 self.b.set_owner(’Iwena Kroka’) 3 self.b.deposit(10) 4 self.assertEqual(self.b. 5 get_transactions(), [10]) 6 self.assertFalse(self.b.is_empty () ) 7 self.assertEqual(self.b.owner, ’Iwena Kroka’) 8 self.assertEqual(self.b.get_balance(), 10) … Assertion Am plification
  • 7. Guest Lecture - Mälardalens Universitet © Serge Demeyer Example - testDeposit_amplified (2/2) 7 1 def testDeposit_amplified (self) : 2 self.b.set_owner(’Iwena Kroka’) 3 self.b.deposit(10) 4 self.assertEqual(self.b. 5 get_transactions(), [10]) 6 self.assertFalse(self.b.is_empty () ) 7 self.assertEqual(self.b.owner, ’Iwena Kroka’) 8 self.assertEqual(self.b.get_balance(), 10) 9 with self.assertRaises(Exception): 10 self.b.deposit(−56313) 11 self.b.deposit(100) 12 self.b.set_owner(’Guido van Rossum’) 13 self.assertEqual(self.b. 14 get_transactions(), [10]) … Input Am plification
  • 8. Guest Lecture - Mälardalens Universitet © Serge Demeyer AmPyfier Engineering 8 AmPyfier: Test amplification in Python Journal of Software Evolution and Process 2022 https://doi.org/10.1002/smr.2490
  • 9. Guest Lecture - Mälardalens Universitet © Serge Demeyer AmPyfier: Validation 9 Strengthened 37 out of 54 test classes
  • 10. Guest Lecture - Mälardalens Universitet © Serge Demeyer SmallAmp: Validation 10 Strengthened 86 out of 156 test classes
  • 11. 11 pull requests 8 merged 3 pending
  • 15. Guest Lecture - Mälardalens Universitet © Serge Demeyer Python Project 15 20% 80% Project Test Suite • Start-up established in 2020 • Fast-growing - more customers - more investors - Single variant • AI engine is vital (Unit) Tests
  • 16. Guest Lecture - Mälardalens Universitet © Serge Demeyer Data Driven Test Amplification 16 Amplification operators must manipulate .csv files import ampyfier @ampyfier.amplify_csv ( "CSVPATH" ) def test_something(amp_file="something.csv"): ...
  • 18. Guest Lecture - Mälardalens Universitet © Serge Demeyer Experimental Set-Up 18 Daily Ampyfier executes tests on main branch Weekly Ampyfier generates new tests
  • 19. Guest Lecture - Mälardalens Universitet © Serge Demeyer Initial Amplification 19 Improvement for 13/25 files • Mutation Score: 20.29% • Code Coverage: 41.39%
  • 20. Guest Lecture - Mälardalens Universitet © Serge Demeyer Continuous Amplification 20 Improvement for all • Mutation score: 7/8 ≈ 87% • Code coverage: 5/8 ≈ 63% • Both: 4/8 ≈ 50%