Chapter 5. Working with test data

 

This chapter covers

  • Retrieving test data from system properties
  • Retrieving test data from environment variables
  • Retrieving test data from files on disk
  • Retrieving test data from a database
  • Managing test data using such tools as Ant, JUnitPP, and DbUnit

Object-oriented software deals with data and behavior. If you are going to test most software prior to releasing it to users or into a production environment, you need test data to simulate inputs that trigger behavior you expect to occur when the software works correctly. Software is commonly written for transforming input data into different output data. You cannot test whether the system outputs the correct output data, usually, without providing it with test input data. Software can also be designed to generate answers from digested input data or to manage data storage and retrieval. Obviously, testing these software behaviors require a lot of test data.

5.1. Use Java system properties

5.2. Use environment variables

5.3. Use an inline data file

5.4. Use a properties file

5.5. Use ResourceBundles

5.6. Use a file-based test data repository

5.7. Use XML to describe test data

5.8. Use Ant���s <sql> task to work with a database

5.9. Use JUnitPP

5.10. Set up your fixture once for the entire suite

5.11. Perform environment setup once for multiple test runs

5.12. Use DbUnit