SlideShare a Scribd company logo
Testing Zen
Improve software quality
and one's quality of life
with fuzz tests, code coverage,
and a fast in-memory database.


Thomas Müller
Day Software AG
Presentation 6640
2



Agenda
• Introduction
• Why Test?



• Test Strategies

      1               2              3
  Fuz z Te s t   C o ve r ag e   Dat a b a s e
3




Introduction

 Thomas Mueller
 Software Engineer

 http://www.h2database.com
 http://www.day.com
 http://jackrabbit.apache.org
3




Introduction

 Thomas Mueller
 Software Engineer

 http://www.h2database.com
 http://www.day.com
 http://jackrabbit.apache.org
3




Introduction

 Thomas Mueller
 Software Engineer

 http://www.h2database.com
 http://www.day.com
 http://jackrabbit.apache.org
3




Introduction

 Thomas Mueller
 Software Engineer

 http://www.h2database.com
 http://www.day.com
 http://jackrabbit.apache.org
4




Why Automated Tests?
4




Why Automated Tests?
1. Less Bugs
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
5. Tests are Samples & Docs
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
5. Tests are Samples & Docs
6. Short Release Cycle
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
5. Tests are Samples & Docs
6. Short Release Cycle
7. Less/No Branching
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
5. Tests are Samples & Docs
6. Short Release Cycle
7. Less/No Branching
8. Predictable Work
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
5. Tests are Samples & Docs
6. Short Release Cycle
7. Less/No Branching
8. Predictable Work
9. Go Home Early
4




Why Automated Tests?
1. Less Bugs
2. Can Refactor
3. Nice Code
4. Nice to Work
5. Tests are Samples & Docs
6. Short Release Cycle
7. Less/No Branching
8. Predictable Work
9. Go Home Early
10. Beer!
5




Testing Strategies
5




Testing Strategies




        1                 2               3
    Fuz z Te s t     C o ve r ag e   Da t a b a s e
6
6




    1
Fu zz Te st
7




Fuzz Testing
•   Random data, operations
•   Low cost, high benefit
•   Find bugs humans don’t
•   Repeatable
•   Tune with code coverage
8




Fuzz Testing Example
 interface DataService {
    void create(int k, String v);
    String read(int k);
    void delete(int k);
 }
8




Fuzz Testing Example
 interface DataService {
    void create(int k, String v);
    String read(int k);
    void delete(int k);
 }




  byte[] b = new byte[100];
  random.nextBytes(b);
  data = new String(b,
    "ISO-8859-1");
8




Fuzz Testing Example
 interface DataService {            Random r = new Random(123);
    void create(int k, String v);   for (int i = 0; i < 10000; i++) {
    String read(int k);                int k = r.nextInt(100);
    void delete(int k);                switch (r.nextInt(3)) {
 }                                     case 0:
                                          ds.create(k, randomString(r));
                                          break;
                                       case 1:
                                          ds.read(k);
  byte[] b = new byte[100];               break;
  random.nextBytes(b);                 case 2:
  data = new String(b,                    ds.delete(k);
    "ISO-8859-1");                        break;
                                       }
                                    }
9
9




     2
C o ve ra ge
10




Code Coverage
• Measure what is tested
• Covered classes,
  methods, blocks, lines
• Find untested, dead code
• Tools: Emma and others
11




Code Coverage Example
11




Code Coverage Example



                        tested
                        untested



                        partially
12




Code Coverage Example
13
13




     3
D at a base
14




Database Testing
• Application uses a big
    database (Oracle,...)
•   Install pain
•   Memory usage
•   License
•   Slow
15




Java SQL Database
15




Java SQL Database
15




Java SQL Database




Size
In-Memory
Performance
Compatible
15




Java SQL Database




Size          1 MB
In-Memory      ++
Performance    ++
Compatible     +
15




Java SQL Database




Size          1 MB   2 MB
In-Memory      ++     -
Performance    ++     -
Compatible     +      -
15




Java SQL Database




Size          1 MB   2 MB   1 MB
In-Memory      ++     -      ++
Performance    ++     -      ++
Compatible     +      -      ++
Testing Zen
Images are Creative Commons licensed:
Thomas Mueller                 Test Well
Software Engineer              http://www.flickr.com/photos/cobalt/409924867
                               Beer
                               http://www.flickr.com/photos/nickwheeleroz/2178156484
http://www.h2database.com
                               Boring
http://www.day.com             http://www.flickr.com/photos/phoenixdailyphoto/1467681879
http://jackrabbit.apache.org   Dice
                               http://www.flickr.com/photos/tim_ellis/402207052
                               Dice (black)
                               http://www.flickr.com/photos/mkamp/2478311790

                               Static Analysis:
                               Checkstyle, FindBugs, PMD

                               Continuous Integration:
                               Hudson, Apache Continuum

                               Continuous Test Runner:
                               Infinitest

More Related Content

PDF
Spock: Test Well and Prosper
PPT
Unit testing with Spock Framework
PDF
Modern Evasion Techniques
PDF
GTAC 2014: What lurks in test suites?
PDF
Java Testing With Spock - Ken Sipe (Trexin Consulting)
PDF
SecLists @ BlackHat Arsenal 2015
PPTX
Debugging NET Applications With WinDBG
PPT
Google C++ Testing Framework in Visual Studio 2008
Spock: Test Well and Prosper
Unit testing with Spock Framework
Modern Evasion Techniques
GTAC 2014: What lurks in test suites?
Java Testing With Spock - Ken Sipe (Trexin Consulting)
SecLists @ BlackHat Arsenal 2015
Debugging NET Applications With WinDBG
Google C++ Testing Framework in Visual Studio 2008

What's hot (20)

PDF
JDK, the not so hidden treasures
ODP
LPW 2007 - Perl Plumbing
PPT
Javaone2008 Bof 5101 Groovytesting
PDF
Ln monitoring repositories
PDF
Sentiment Analysis API on AWS Lambda (feat. SAM, BotHub.Studio)
PDF
Finding Needles in Haystacks
PDF
Is your profiler speaking the same language as you? -- Docklands JUG
PDF
Spock Framework
PDF
Ruxmon feb 2013 what happened to rails
PDF
Real World Mocking In Swift
PDF
Functional tests with TYPO3
PPT
Just in Time Resourcing
ODP
Testing Toolbox
PPTX
Smarter Testing With Spock
PDF
Ruxmon cve 2012-2661
PDF
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
PDF
Nine Circles of Inferno or Explaining the PostgreSQL Vacuum
PDF
Node Interactive Debugging Node.js In Production
PPT
GTAC Boosting your Testing Productivity with Groovy
PDF
A Modest Introduction To Swift
JDK, the not so hidden treasures
LPW 2007 - Perl Plumbing
Javaone2008 Bof 5101 Groovytesting
Ln monitoring repositories
Sentiment Analysis API on AWS Lambda (feat. SAM, BotHub.Studio)
Finding Needles in Haystacks
Is your profiler speaking the same language as you? -- Docklands JUG
Spock Framework
Ruxmon feb 2013 what happened to rails
Real World Mocking In Swift
Functional tests with TYPO3
Just in Time Resourcing
Testing Toolbox
Smarter Testing With Spock
Ruxmon cve 2012-2661
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
Nine Circles of Inferno or Explaining the PostgreSQL Vacuum
Node Interactive Debugging Node.js In Production
GTAC Boosting your Testing Productivity with Groovy
A Modest Introduction To Swift
Ad

Viewers also liked (12)

PDF
Scala4sling
 
PDF
Scala for scripting
 
KEY
Performance Pack
 
PDF
Apache Con U S07 F F T Sling
 
PDF
Embrace OSGi Apache Con Europe2009
 
PDF
Tarpm Clustering
 
PDF
Scripting Yor Java Application with BSF3
 
KEY
Java Persistence Frameworks
 
PDF
PDF
(Re)discover your AEM
PDF
Adobe AEM - From Eventing to Job Processing
PDF
Understanding Sling Models in AEM
Scala4sling
 
Scala for scripting
 
Performance Pack
 
Apache Con U S07 F F T Sling
 
Embrace OSGi Apache Con Europe2009
 
Tarpm Clustering
 
Scripting Yor Java Application with BSF3
 
Java Persistence Frameworks
 
(Re)discover your AEM
Adobe AEM - From Eventing to Job Processing
Understanding Sling Models in AEM
Ad

Similar to Testing Zen (20)

PDF
SCAM 2012 Keynote Slides on Cooperative Testing and Analysis by Tao Xie
PDF
Performance - a challenging craft
PDF
Software testing
DOCX
SoftwareDevExperience
PDF
Presentation
PPTX
Software Quality via Unit Testing
PDF
Testing practicies not only in scala
PPT
Testing In Java
PPTX
SE - Lecture 8 - Software Testing State Diagram.pptx
PDF
Testing untestable code - phpday
PPT
Black box-software-testing-douglas-hoffman2483
PDF
Testing untestable code - phpconpl11
PDF
Testing untestable code - STPCon11
PPTX
Testing banking apps
PDF
Mobile App Testing: Design Automation Patterns You Should Use
PDF
Test and Behaviour Driven Development (TDD/BDD)
PDF
software-testing-yogesh-singh (1).pdf
PPTX
Software Development (Mobile Technology)
PDF
Николай Бьернер «Program Analysis and Testing using Efficient Satisfiability ...
PPTX
Softwere Testing Aplication Specific Techniques
SCAM 2012 Keynote Slides on Cooperative Testing and Analysis by Tao Xie
Performance - a challenging craft
Software testing
SoftwareDevExperience
Presentation
Software Quality via Unit Testing
Testing practicies not only in scala
Testing In Java
SE - Lecture 8 - Software Testing State Diagram.pptx
Testing untestable code - phpday
Black box-software-testing-douglas-hoffman2483
Testing untestable code - phpconpl11
Testing untestable code - STPCon11
Testing banking apps
Mobile App Testing: Design Automation Patterns You Should Use
Test and Behaviour Driven Development (TDD/BDD)
software-testing-yogesh-singh (1).pdf
Software Development (Mobile Technology)
Николай Бьернер «Program Analysis and Testing using Efficient Satisfiability ...
Softwere Testing Aplication Specific Techniques

More from day (14)

PDF
Tech Summit 08 Support Initiative
 
PDF
Non Cms For Web Apps
 
PDF
Getting Into The Flow With Cq Dam
 
PDF
Dispatcher Oom
 
PDF
Advanced Collaboration And Beyond
 
PDF
Wc Mand Connectors2
 
PPT
Jackrabbit Roadmap
 
PPT
Doc Book Vs Dita
 
PPT
Doc Book Vs Dita Teresa
 
PDF
862
 
PDF
Apache Con Us2007 Sanselan
 
PDF
Apache Con Us2007 Jcr In Action
 
PDF
Apache Con Us2007 Apachei Batis
 
PDF
200711 R E S T Apache Con
 
Tech Summit 08 Support Initiative
 
Non Cms For Web Apps
 
Getting Into The Flow With Cq Dam
 
Dispatcher Oom
 
Advanced Collaboration And Beyond
 
Wc Mand Connectors2
 
Jackrabbit Roadmap
 
Doc Book Vs Dita
 
Doc Book Vs Dita Teresa
 
862
 
Apache Con Us2007 Sanselan
 
Apache Con Us2007 Jcr In Action
 
Apache Con Us2007 Apachei Batis
 
200711 R E S T Apache Con
 

Recently uploaded (20)

PPTX
Viral_A Study of Acts_Acts 9.19b-31_Slides.pptx
PPTX
The Human Person as an Embodied Spirit.pptx
PDF
Printable Khmer Gospel Tract - Be Sure of Heaven.pdf
PDF
Heavenly Holy Spirit vs False Spirit: An Analysis of 1 Peter 1:12 by Matthews...
PPTX
Faith and Gratitude: Guide to the Baccalaureate Mass & Responses
PPTX
Joshua Through the Lens of Jesus: Part 8 - Ch.22-24
PDF
Printable Lao Gospel Tract - Be Sure of Heaven.pdf
PPTX
"Deeping our commitment to Christ" A Lecture
PDF
Printable Kinyarwanda Gospel Tract - Be Sure of Heaven.pdf
PDF
noticeanddeclarationoftruthjc-dkr-08022025-01signinglog-250802103439-0b8a8d39...
PPT
The Altar Call Training for All Belivers
PDF
Printable Japanese Gospel Tract - Be Sure of Heaven.pdf
PDF
Printable Macedonian Gospel Tract - Be Sure of Heaven.pdf
PPTX
Has-Satans-Little-Season-Already-Begun.pptx
PPTX
Lesson study with details and Photos. Easy
PDF
Printable Maldivian Divehi Gospel Tract - Be Sure of Heaven.pdf
PDF
Printable Kurdish Northern Kurmanji Gospel Tract - Be Sure of Heaven.pdf
PDF
Printable Malagasy Gospel Tract - Be Sure of Heaven.pdf
PPTX
Archbishop Louis Mathias - Missionaory.pptx
PDF
BABYLON JERUSALEM COMPARATIVE ANALYSIS.pdf
Viral_A Study of Acts_Acts 9.19b-31_Slides.pptx
The Human Person as an Embodied Spirit.pptx
Printable Khmer Gospel Tract - Be Sure of Heaven.pdf
Heavenly Holy Spirit vs False Spirit: An Analysis of 1 Peter 1:12 by Matthews...
Faith and Gratitude: Guide to the Baccalaureate Mass & Responses
Joshua Through the Lens of Jesus: Part 8 - Ch.22-24
Printable Lao Gospel Tract - Be Sure of Heaven.pdf
"Deeping our commitment to Christ" A Lecture
Printable Kinyarwanda Gospel Tract - Be Sure of Heaven.pdf
noticeanddeclarationoftruthjc-dkr-08022025-01signinglog-250802103439-0b8a8d39...
The Altar Call Training for All Belivers
Printable Japanese Gospel Tract - Be Sure of Heaven.pdf
Printable Macedonian Gospel Tract - Be Sure of Heaven.pdf
Has-Satans-Little-Season-Already-Begun.pptx
Lesson study with details and Photos. Easy
Printable Maldivian Divehi Gospel Tract - Be Sure of Heaven.pdf
Printable Kurdish Northern Kurmanji Gospel Tract - Be Sure of Heaven.pdf
Printable Malagasy Gospel Tract - Be Sure of Heaven.pdf
Archbishop Louis Mathias - Missionaory.pptx
BABYLON JERUSALEM COMPARATIVE ANALYSIS.pdf

Testing Zen

  • 1. Testing Zen Improve software quality and one's quality of life with fuzz tests, code coverage, and a fast in-memory database. Thomas Müller Day Software AG Presentation 6640
  • 2. 2 Agenda • Introduction • Why Test? • Test Strategies 1 2 3 Fuz z Te s t C o ve r ag e Dat a b a s e
  • 3. 3 Introduction Thomas Mueller Software Engineer http://www.h2database.com http://www.day.com http://jackrabbit.apache.org
  • 4. 3 Introduction Thomas Mueller Software Engineer http://www.h2database.com http://www.day.com http://jackrabbit.apache.org
  • 5. 3 Introduction Thomas Mueller Software Engineer http://www.h2database.com http://www.day.com http://jackrabbit.apache.org
  • 6. 3 Introduction Thomas Mueller Software Engineer http://www.h2database.com http://www.day.com http://jackrabbit.apache.org
  • 9. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor
  • 10. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code
  • 11. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work
  • 12. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work 5. Tests are Samples & Docs
  • 13. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work 5. Tests are Samples & Docs 6. Short Release Cycle
  • 14. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work 5. Tests are Samples & Docs 6. Short Release Cycle 7. Less/No Branching
  • 15. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work 5. Tests are Samples & Docs 6. Short Release Cycle 7. Less/No Branching 8. Predictable Work
  • 16. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work 5. Tests are Samples & Docs 6. Short Release Cycle 7. Less/No Branching 8. Predictable Work 9. Go Home Early
  • 17. 4 Why Automated Tests? 1. Less Bugs 2. Can Refactor 3. Nice Code 4. Nice to Work 5. Tests are Samples & Docs 6. Short Release Cycle 7. Less/No Branching 8. Predictable Work 9. Go Home Early 10. Beer!
  • 19. 5 Testing Strategies 1 2 3 Fuz z Te s t C o ve r ag e Da t a b a s e
  • 20. 6
  • 21. 6 1 Fu zz Te st
  • 22. 7 Fuzz Testing • Random data, operations • Low cost, high benefit • Find bugs humans don’t • Repeatable • Tune with code coverage
  • 23. 8 Fuzz Testing Example interface DataService { void create(int k, String v); String read(int k); void delete(int k); }
  • 24. 8 Fuzz Testing Example interface DataService { void create(int k, String v); String read(int k); void delete(int k); } byte[] b = new byte[100]; random.nextBytes(b); data = new String(b, "ISO-8859-1");
  • 25. 8 Fuzz Testing Example interface DataService { Random r = new Random(123); void create(int k, String v); for (int i = 0; i < 10000; i++) { String read(int k); int k = r.nextInt(100); void delete(int k); switch (r.nextInt(3)) { } case 0: ds.create(k, randomString(r)); break; case 1: ds.read(k); byte[] b = new byte[100]; break; random.nextBytes(b); case 2: data = new String(b, ds.delete(k); "ISO-8859-1"); break; } }
  • 26. 9
  • 27. 9 2 C o ve ra ge
  • 28. 10 Code Coverage • Measure what is tested • Covered classes, methods, blocks, lines • Find untested, dead code • Tools: Emma and others
  • 30. 11 Code Coverage Example tested untested partially
  • 32. 13
  • 33. 13 3 D at a base
  • 34. 14 Database Testing • Application uses a big database (Oracle,...) • Install pain • Memory usage • License • Slow
  • 38. 15 Java SQL Database Size 1 MB In-Memory ++ Performance ++ Compatible +
  • 39. 15 Java SQL Database Size 1 MB 2 MB In-Memory ++ - Performance ++ - Compatible + -
  • 40. 15 Java SQL Database Size 1 MB 2 MB 1 MB In-Memory ++ - ++ Performance ++ - ++ Compatible + - ++
  • 42. Images are Creative Commons licensed: Thomas Mueller Test Well Software Engineer http://www.flickr.com/photos/cobalt/409924867 Beer http://www.flickr.com/photos/nickwheeleroz/2178156484 http://www.h2database.com Boring http://www.day.com http://www.flickr.com/photos/phoenixdailyphoto/1467681879 http://jackrabbit.apache.org Dice http://www.flickr.com/photos/tim_ellis/402207052 Dice (black) http://www.flickr.com/photos/mkamp/2478311790 Static Analysis: Checkstyle, FindBugs, PMD Continuous Integration: Hudson, Apache Continuum Continuous Test Runner: Infinitest