This page contains example Java programs for the book Introduction to Software Testing by Paul Ammann and Jeff Offutt, Cambridge University Press. These programs are available for instructors, students and readers of the book. The authors reserve the copyright on all programs, but grant permission for them to be used for educational purposes. The programs can be modified as long as the authorship and reference to the book remains intact.

Programs that are in the book in partial form have been augmented with a main() method so they can be run from the command line. All programs have been compiled with Java 1.5.

The C# versions were contributed by Aresh Saharkhiz of Mapua Institute of Technology in the Philippines.

The authors welcome corrections, updates and additions. We will be glad to credit any contributors to these programs.

Jeff Offutt & Paul Ammann
Back to the book website ...

Program (Java)Program (C#)LocationLast Update
1. Introduction
numZero.javanumZero.java.csSection 1.2, page 1228-Jan-2008
findLast.javafindLast.java.csSection 1.2, page 1628-Aug-2008
lastZero.javalastZero.java.csSection 1.2, page 1628-Aug-2008
countPositive.javacountPositive.java.csSection 1.2, page 1627-Jan-2008
oddOrPos.javaoddOrPos.java.csSection 1.2, page 1628-Aug-2008
2. Graph Testing
TestPat.java TestPat.java.cs Section 2.3, page 5628-Jan-2008
TestPatInstrument.javaTestPatInstrument.java.csSection 2.3, page 613-Jun-2008
fmtRewrap.javafmtRewrap.java.csSection 2.3, page 6228-Jan-2008
printPrimes.javaprintPrimes.java.csSection 2.3, page 6328-Jan-2008
Quadratic.javaQuadratic.java.csSection 2.4, page 7128-Jan-2008
trashAndTakeOut.javatrashAndTakeOut.java.csSection 2.4, page 7428-Jan-2008
Stutter.javaStutter.java.csSection 2.5, page 8028-Jan-2008
Queue.javaQueue.java.csSection 2.5, page 8628-Jan-2008
stats.javastats.java.csSection 2.3, slides27-Sept-2010
3. Logic Testing
trityp.javatrityp.java.csSection 3.3, page 12128-Jan-2008
checkIt.javacheckIt.java.csSection 3.3, page 13028-Jan-2008
twoPred.javatwoPred.java.csSection 3.3, page 13028-Jan-2008
TestPat.java TestPat.java.cs Section 3.3, page 13111-Jun-2014
cal.javacal.java.csSection 3.4, page 13228-Jan-2008
4. Input Space Partitioning
BoundedQueue.javaBoundedQueue.java.csSection 4.2, page 16426-Mar-2008
5. Syntax-based Testing
findVal.javafindVal.java.csSection 5.2, page 18928-Jan-2008
sum.javasum.java.csSection 5.2, page 18928-Jan-2008
TestPatA.java TestPatA.java.cs Section 5.2, page 18911-Jun-2014
TestPatB.java TestPatB.java.cs Section 5.2, page 18911-Jun-2014
cal.javacal.java.csSection 5.2, page 19028-Jan-2008
power.javapower.java.csSection 5.2, page 19128-Jan-2008
6. Practical Considerations
7. Engineering Criteria for Technologies
f.javaSection 7.1, page 24228-Jan-2008
8. Building Testing Tools
9. Challenges in Testing Software
 
Last update: 25 February, 2013.
Thanks to Shuang Wang