SlideShare a Scribd company logo
Automated Unit Test Generation

Vassil Popovski, VMware
The Cost of Software Bugs?
$59.9 B per year in USA (NIST, 2002)*
(*) http://www.nist.gov/director/planning/upload/report02-3.pdf
$312 B per year worldwide (Cambridge University, 2012)**
(**) http://www.roguewave.com/DesktopModules/Bring2mind/DMX/Download.aspx?entryid=1606&command=core_download&PortalId=0&TabId=607
$312,000,000,000
The Cost of Software Bugs?
The Cost of Software Bugs?
Total market capitalization for all 3 companies(*):
!
$177.36 B
(*) Google finance - as of Nov 2nd, 2013
The Cost of World Hunger?
$40B per year(*)
(*) According to United Nations
The Cost of Fixing Bugs?
http://www.amazon.com/Assessments-Benchmarks-Addison-Wesley-Information-Technology/dp/0201485427?
ie=UTF8&s=books&qid=1209056706&sr=1-1
Software Testing Pyramid
http://blogs.agilefaqs.com/2011/02/01/inverting-the-testing-pyramid/
Unit Testing: 80-90%
Integration testing: 4-15%
E2E/GUI testing: 1-5%
Techniques/Tools
1. Random data generation
2. Search based
3. Symbolic/Concolic based
The goal: High (close to 100% code coverage*)
Anatomy of a Unit Test
Arrange
Act
Assert
Anatomy of a Unit Test
Arrange Data
Arrange Mocks/Stubs
Act
Assert
Anatomy of a Unit Test
Evaluation of Tools
Arrange/Generate
Data
Arrange/Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results
Techniques/Tools
x != 100 x == 100
x>=z x<z
if
if
Techniques/Tools
x>=z x<z
if
ifRandom data generation:
!
Feed x,y with random data
x != 100 x == 100
Demo
Evaluation of Tools
Arrange/Generate
Data
Arrange/Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results
junit-quickcheck
feed4JUnit
yes - some
no
no
no
Techniques/Tools
1. Random Data Generation:
• junit-quickcheck (Java)
https://github.com/pholser/junit-quickcheck/
• Feed4JUnit & Feed4TestNG + Benerator (java)
http://databene.org/feed4-tools.html
http://databene.org/databene-benerator.html
• Randoop (Java + .NET)
https://code.google.com/p/randoop/
• T2 (Java)
https://code.google.com/p/t2framework/
Techniques/Tools
x != 100 x == 100
x>=z x<z
if
ifSearch based approach:
!
1. Start with random/initial data
(x=1, y=1)
Techniques/Tools
x != 100 x == 100
x>=z x<z
if
ifSearch based approach:
!
1. Start with random/initial data
(x=1, y=1)
x=1, y=1
Techniques/Tools
x != 100
x>=z x<z
if
ifSearch based approach:
!
1. Start with random/initial data
(x=1, y=1)
x=1, y=1
x == 100
Techniques/Tools
x == 100
x>=z x<z
if
ifSearch based approach:
!
1. Start with random/initial data
(x=1, y=1)
2. Based on coverage information
- select new value(s) (x==100)
!
x != 100
x=1, y=1
Techniques/Tools
x == 100
x>=z x<z
if
ifSearch based approach:
!
1. Start with random/initial data
(x=1, y=1)
2. Based on coverage information
- select new value(s) (x==100)
x=100, y=1
x != 100
Demo
Evaluation of Tools
Arrange/Generate
Data
Arrange/Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results
yes - some
no
no
no
EvoSuite
yes
no
yes
yes
junit-quickcheck
feed4JUnit
Techniques/Tools
2. Search Based:
• EvoSuite (Java)
http://www.evosuite.org/
• Testful (Java)
https://code.google.com/p/testful/
Techniques/Tools
x != 100 x == 100
x>=z x<z
if
ifSymbolic based approach:
!
1. Evaluate path conditions (PC)
on every branch PC: X!=100, Y PC: X == 100, Y
x=X, y=Y, z=2*Y
PC: X == 100,
X>=2*Y
PC: X == 100,
X<2*Y
1. X!=100, Y => (x=1, y=1)
2. X=100, X>=2*Y =>(x=100, y=1)
3. X=100, X<2*Y =>(x=100, y=51)
2. For each leaf - calculate X & Y
using constraints solver:
Techniques/Tools
x != 100 x == 100
x>=z x<z
if
ifConcolic based approach:
!
Optimization of symbolic
execution - but use real values
for some of the branches
Demo
Evaluation of Tools
Arrange/Generate
Data
Arrange/Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results
yes - some
no
no
no
EvoSuite
yes
no
yes
yes
PEX (+ Moles)
yes
yes - some
yes
yes
junit-quickcheck
feed4JUnit
Techniques/Tools
3. Symbolic/Concolic based:
• Microsoft Pex (.NET)
http://research.microsoft.com/en-us/projects/pex/
• jCUTE (Java)
http://osl.cs.uiuc.edu/software/jcute/
• jalangi (Java Script)
https://github.com/SRA-SiliconValley/jalangi
• AgitarOne (Java, commercial)
http://www.agitar.com/solutions/products/agitarone.html
• Jtest (Java, commercial)
http://www.parasoft.com/jsp/products/jtest.jsp
Best usage of Auto Generated Unit Tests
1.Regression testing of legacy code
!
2.To support your unit testing / TDD
Automatic Generation of GUI/API tests?
Q&A
Thank you
!
Vassil Popovski
!
Director, R&D, VMware
vpopovski@vmware.com

More Related Content

Similar to Automated Unit Test Generation - ISTA 2013

Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
Droidcon Berlin
 
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
acijjournal
 
Learning from Computer Simulation to Tackle Real-World Problems
Learning from Computer Simulation to Tackle Real-World ProblemsLearning from Computer Simulation to Tackle Real-World Problems
Learning from Computer Simulation to Tackle Real-World Problems
NAVER Engineering
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
Enrique López Mañas
 
Software testing
Software testingSoftware testing
Software testing
DIPEN SAINI
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
guest3379bd
 
ML基本からResNetまで
ML基本からResNetまでML基本からResNetまで
ML基本からResNetまで
Institute of Agricultural Machinery, NARO
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon Satrom
Future Insights
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
QA or the Highway
 
The Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzThe Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig Stuntz
QA or the Highway
 
Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015
Buşra Deniz, CSM
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
davejohnson
 
Lab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docx
Lab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docxLab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docx
Lab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docx
DIPESH30
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debugging
svilen.ivanov
 
DSR Testing (Part 2)
DSR Testing (Part 2)DSR Testing (Part 2)
DSR Testing (Part 2)
Steve Upton
 
Use Machine Learning to Get the Most out of Your Big Data Clusters
Use Machine Learning to Get the Most out of Your Big Data ClustersUse Machine Learning to Get the Most out of Your Big Data Clusters
Use Machine Learning to Get the Most out of Your Big Data Clusters
Databricks
 
Beyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even furtherBeyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even further
Johan Janssen
 
Examview testmanager userguide 8.1
Examview testmanager userguide 8.1Examview testmanager userguide 8.1
Examview testmanager userguide 8.1
William McIntosh
 
Django tricks (2)
Django tricks (2)Django tricks (2)
Django tricks (2)
Carlos Hernando
 
Automatically Discovering, Reporting and Reproducing Android Application Crashes
Automatically Discovering, Reporting and Reproducing Android Application CrashesAutomatically Discovering, Reporting and Reproducing Android Application Crashes
Automatically Discovering, Reporting and Reproducing Android Application Crashes
Kevin Moran
 

Similar to Automated Unit Test Generation - ISTA 2013 (20)

Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
 
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
 
Learning from Computer Simulation to Tackle Real-World Problems
Learning from Computer Simulation to Tackle Real-World ProblemsLearning from Computer Simulation to Tackle Real-World Problems
Learning from Computer Simulation to Tackle Real-World Problems
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
Software testing
Software testingSoftware testing
Software testing
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
ML基本からResNetまで
ML基本からResNetまでML基本からResNetまで
ML基本からResNetまで
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon Satrom
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
 
The Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzThe Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig Stuntz
 
Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Lab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docx
Lab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docxLab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docx
Lab Deliverable for Lab nYour NameDateTitle Creating, Using, Remo.docx
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debugging
 
DSR Testing (Part 2)
DSR Testing (Part 2)DSR Testing (Part 2)
DSR Testing (Part 2)
 
Use Machine Learning to Get the Most out of Your Big Data Clusters
Use Machine Learning to Get the Most out of Your Big Data ClustersUse Machine Learning to Get the Most out of Your Big Data Clusters
Use Machine Learning to Get the Most out of Your Big Data Clusters
 
Beyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even furtherBeyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even further
 
Examview testmanager userguide 8.1
Examview testmanager userguide 8.1Examview testmanager userguide 8.1
Examview testmanager userguide 8.1
 
Django tricks (2)
Django tricks (2)Django tricks (2)
Django tricks (2)
 
Automatically Discovering, Reporting and Reproducing Android Application Crashes
Automatically Discovering, Reporting and Reproducing Android Application CrashesAutomatically Discovering, Reporting and Reproducing Android Application Crashes
Automatically Discovering, Reporting and Reproducing Android Application Crashes
 

Recently uploaded

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
AnkitaPandya11
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 

Recently uploaded (20)

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 

Automated Unit Test Generation - ISTA 2013