What Are Some Tips For Writing A Large Number of Unit Tests?
Posted
by
joshin4colours
on Programmers
See other posts from Programmers
or by joshin4colours
Published on 2012-08-21T16:25:53Z
Indexed on
2012/10/25
17:12 UTC
Read the original article
Hit count: 233
I've recently been tasked with testing some COM objects of the desktop app I work on. What this means in practice is writing a large number (>100) unit tests to test different but related methods and objects. While the unit tests themselves are fairly straight forward (usually one or two Assert()-type checks per test), I'm struggling to figure out the best way to write these tests in a coherent, organized manner. What I have found is that copy and Paste coding should be avoided. It creates more problems than it's worth, and it's even worse than copy-and-paste code in production code because test code has to be more frequently updated and modified.
I'm leaning toward trying an OO-approach using but again, the sheer number makes even this approach daunting from an organizational standpoint due to concern with maintenance. It also doesn't help that the tests are currently written in C++, which adds some complexity with memory management issues.
Any thoughts or suggestions?
© Programmers or respective owner