Next: Notes
Up: Unit Testing Database Code
Previous: Create a test database
Contents
Index
Use mock objects
A second line of thought when testing database code involves the use of ``mock objects'' to simulate the database.
Pro's:
- Runs much faster than tests against a real database.
- Lets you test database exception conditions.
- Can test interesting things like exceptions, and returning connections back to the pool.
Con's:
- Any time you deal with mock objects you have to think about the time you are investing to create the artificial support environment.
- When the database changes your tests may not fail, because you are not testing against it.
Next: Notes
Up: Unit Testing Database Code
Previous: Create a test database
Contents
Index