Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing another object?
Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.