Write the unit tests to use memory validation

Most of the time, unit tests should be written to verify results in memory in order have them run as quickly as possible.  However, in the example given in an earlier example, each test should use a verification file to determine if the test was successful or not.

In this example, each test should write out the file and then read it back in again and compare it the verification file for that test.  The comparison function should be written to ignore things that are expected to be different with each run like the date and time of the report.

Prev          Next          Back to write the unit tests

Copyright 2011 by Robert G. Bryan

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s