JUnit: A Hands-On Introduction for Testers
Please turn off all
Getting to Know Each Other
Different Kinds of Tests
Different Styles of Testing
When To Write the Tests
Or
Benefits of Test Driven Development
Why test?
For Unit Testing to Work
Micro Test Driven Development
Everything is preceded by a test
Macro Test Driven Development
Test Driven Testing
JUnit
A class to test: The Fraction Class
Test Classes
Exercise 1: Compile and run the simple addition test
What else do we need to test?
Exercise 2: Expanding the test suite
Answer 2: Expanding the test suite
Unit Testing
Reinitialization Example
Consequences
static data is not reinitialized
Fixtures
Exercise 3: Adding a Fixture
Answer 3: Adding a Fixture
Freeing resources after each test
Constructors for TestCase
Exercise 4: Adding a Constructor
Answer 4: Adding a Constructor
Assertion Messages
Exercise 5: Messages
Answer 5: Assertion Messages
Floating point assertions
Exercise 6: Floating point test
Answer 6: Floating point test
Integer assertions
Exercise 7: Integer test
Answer 7: Integer test
Integration Tests
Exercise 8: Data Driven TestCase
Answer 8: Data Driven Test
Data Driven Test Issues
Answer 8 Improved: Data Driven Test
Object comparisons: asserting object equality
Object comparisons: asserting object identity
Asserting Truth
Asserting Falsity
Asserting Nullness
Asserting Non-Nullness
Deliberately failing a test
Tests that throw Exceptions
Testing exceptional conditions
Exercise 9: Exploring an API through Tests
Answer 9: Testing Exceptional Conditions
Testing Files
Faking Input
Testing Output
Exercise 10: Serialization
Answer 10: Testing I/O
Test Suites
Test Suites
Test Suites
Test Suites Can Be Combined Into Larger Suites
Testing Fields
Testing Protected Methods
Testing Abstract Classes
Testing Package Protected Methods
Testing Private Methods
Testing Interfaces
Data driven tests
Parameterized TestCase Example
What to Test
What Not to Test
Exploring the JavaDoc for things to test
Group Exercise: Reading the JavaDoc
The Real FractionTest Class
TestRunners
Main method for TestCase
Exercise 11: Adding a main method
Answer 11: Adding a main method
Exercise 12: Test First Development
Answer 12: Writing the Test First
Answer 12: Changing the Code
Answer 12: Compiling with Maven
Answer 12: Writing Another Test
Answer 12: Changing the Code Again
TestListeners
Writing Your Own TestListener
Writing Your Own TestRunner
Integrating Tests into the Build Process
Ant
Ant Reports
Maven
Excluding Tests from the JavaDoc
Test Suite Performance
Profiling tests
Smoke tests
Unnecessary Initialization
Measuring Test Coverage
Testing Databases
Testing Web Servers and Services
To Learn More
Questions?
Entire Presentation as Single File
Start
|
Cafe con Leche
|
Cafe au Lait
Copyright 2005 Elliotte Rusty Harold
Last Modified September 6, 2005