On Friday, January 17, 2003, 4:22:16 AM, Travis wrote: > I'm just starting to get into unit testing, and I can already see how powerful > a tool it can be to preemptively find bugs in my programs; however, a good > portion of the classes I write revolve around databases and CGI. A lot of the > methods implemented in these classes return highly variable results. Is there > a way for me to leverge the benefits of unit testing when working with this > type of data? [code snipped] > Would there be a way to use unit test my get_pct_solids method, or is it only > suited for environments where functions return predictable values? Several times in the past, I've created test data in test tables (or perhaps tables of the same name in a different database). This can be quite arduous, and has indeed taken a long time to get right. To do it properly, you need to create the test data in #setup, and remove it in #teardown. I haven't used mock objects, as Hugh suggests, but based on my experiences with hardcoding test data in a database, I'll certainly look into them next time. Cheers, Gavin