SlideShare a Scribd company logo
1 of 39
Download to read offline
Automated Unit Test Generation

Vassil Popovski, VMware
The Cost of Software Bugs?
$59.9 B per year in USA (NIST, 2002)*
$312 B per year worldwide (Cambridge University, 2012)**

(*) http://www.nist.gov/director/planning/upload/report02-3.pdf
(**) http://www.roguewave.com/DesktopModules/Bring2mind/DMX/Download.aspx?
entryid=1606&command=core_download&PortalId=0&TabId=607
The Cost of Software Bugs?

$312,000,000,000
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
E2E/GUI testing:

1-5%

Integration testing: 4-15%
Unit Testing:

http://blogs.agilefaqs.com/2011/02/01/inverting-the-testing-pyramid/

80-90%
Techniques/Tools

The goal: High (close to 100% code coverage*)
1. Random data generation
2. Search based
3. Symbolic/Concolic based
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>=z

x == 100

x<z
Techniques/Tools
Random data generation:
!

x != 100

x == 100

Feed x,y with random data
x>=z

x<z
Demo
Evaluation of Tools
junit-quickcheck
feed4JUnit
Arrange/
Generate Data
Arrange/
Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results

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
Search based approach:
!

x != 100

x == 100

1. Start with random/initial
data (x=1, y=1)
x>=z

x<z
Techniques/Tools
x=1, y=1
Search based approach:
!

x != 100

x == 100

1. Start with random/initial
data (x=1, y=1)
x>=z

x<z
Techniques/Tools
x=1, y=1
Search based approach:
!

x != 100

x == 100

1. Start with random/initial
data (x=1, y=1)
x>=z

x<z
Techniques/Tools
x=100, y=1
Search 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>=z

x == 100

x<z
Techniques/Tools
x=100, y=1
Search based approach:
x != 100

!

1. Start with random/initial
data (x=1, y=1)
2. Based on coverage
information - select new
value(s) (x==100)
!

x>=z

x == 100

x<z
Demo
Evaluation of Tools
junit-quickcheck
feed4JUnit
Arrange/
Generate Data
Arrange/
Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results

yes - some

EvoSuite

yes

no

no

no

yes

no

yes
Techniques/Tools
2. Search Based:
• EvoSuite (Java)
http://www.evosuite.org/
• Testful (Java)
https://code.google.com/p/testful/
Techniques/Tools
x=X, y=Y, z=2*Y

Symbolic based approach:
!

x != 100

x == 100

1. Evaluate path conditions (PC)
PC: X!=100, Y
PC: X == 100, Y
on every branch
2. For each leaf - calculate X & Y
x>=z
x<z
using a constraints solver:
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)

PC: X == 100, PC: X == 100,
X>=2*Y
X<2*Y
Techniques/Tools
Concolic based
approach:

x != 100

x == 100

!

Optimization of symbolic
execution - but use real
values for some of the
branches

x>=z

x<z
Demo
Evaluation of Tools
junit-quickcheck
feed4JUnit
Arrange/
Generate Data
Arrange/
Generate
Mocks/Stubs
Act/Invoke
methods
Assert/Verify
the results

yes - some

EvoSuite

PEX (+ Moles)

yes

yes

no

no

no

yes

yes

no

yes

yes

yes - some
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
Q&A
Thank you
!

Vassil Popovski
!

Sr. Director, R&D, VMware
vpopovski@vmware.com

More Related Content

Similar to Automated unit test generation presentation - Java2ays 2013

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 ProblemsNAVER Engineering
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building AndroidDroidcon Berlin
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversingEnrique López Mañas
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromFuture Insights
 
Youtube big data analysis using hadoop,pig,hive
Youtube big data analysis using hadoop,pig,hiveYoutube big data analysis using hadoop,pig,hive
Youtube big data analysis using hadoop,pig,hivepankaj chhipa
 
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
 
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 2015Buşra Deniz, CSM
 
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.docxDIPESH30
 
DSR Testing (Part 2)
DSR Testing (Part 2)DSR Testing (Part 2)
DSR Testing (Part 2)Steve Upton
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debuggingsvilen.ivanov
 
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 furtherJohan Janssen
 
Examview testmanager userguide 8.1
Examview testmanager userguide 8.1Examview testmanager userguide 8.1
Examview testmanager userguide 8.1William McIntosh
 
SOFTWARE ENGINEERING UNIT 6 Ch 13
SOFTWARE ENGINEERING UNIT 6 Ch 13SOFTWARE ENGINEERING UNIT 6 Ch 13
SOFTWARE ENGINEERING UNIT 6 Ch 13Azhar Shaik
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
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 ClustersDatabricks
 
멀티플랫폼 앱 개발과 테스팅
멀티플랫폼 앱 개발과 테스팅멀티플랫폼 앱 개발과 테스팅
멀티플랫폼 앱 개발과 테스팅WooKyoung Noh
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterpriseDave Artz
 

Similar to Automated unit test generation presentation - Java2ays 2013 (20)

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
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon Satrom
 
Django tricks (2)
Django tricks (2)Django tricks (2)
Django tricks (2)
 
Youtube big data analysis using hadoop,pig,hive
Youtube big data analysis using hadoop,pig,hiveYoutube big data analysis using hadoop,pig,hive
Youtube big data analysis using hadoop,pig,hive
 
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...
 
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
 
Good Practices On Test Automation
Good Practices On Test AutomationGood Practices On Test Automation
Good Practices On Test Automation
 
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
 
DSR Testing (Part 2)
DSR Testing (Part 2)DSR Testing (Part 2)
DSR Testing (Part 2)
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debugging
 
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
 
AI Development with H2O.ai
AI Development with H2O.aiAI Development with H2O.ai
AI Development with H2O.ai
 
Examview testmanager userguide 8.1
Examview testmanager userguide 8.1Examview testmanager userguide 8.1
Examview testmanager userguide 8.1
 
SOFTWARE ENGINEERING UNIT 6 Ch 13
SOFTWARE ENGINEERING UNIT 6 Ch 13SOFTWARE ENGINEERING UNIT 6 Ch 13
SOFTWARE ENGINEERING UNIT 6 Ch 13
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
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
 
멀티플랫폼 앱 개발과 테스팅
멀티플랫폼 앱 개발과 테스팅멀티플랫폼 앱 개발과 테스팅
멀티플랫폼 앱 개발과 테스팅
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 

Recently uploaded

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Recently uploaded (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Automated unit test generation presentation - Java2ays 2013