tags:

views:

65

answers:

1

Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing another object?

+5  A: 

Yes - When you are writing unit tests for the code that does the IO.

No - When you are writing unit tests for code that call the methods that you just tested above.

I'd mark the first set of tests with a xUnit category/tag marked 'Slow' or some such label and run them less frequently. Over time they will significantly slow down the time needed to run your automated test suite. So make it easy to exclude the slow tests, => developer feedback stays close to instantaneous and have the build server run the slow tests along with the rest on every check-in. If it's really time consuming.. then maybe you can run the "Slow" tests every night or so.

Gishu