Unit testing C++ code (using Python?)
Posted on 2003-11-03
I'm about to start a medium sized project using C++ throughout. I want to use unit testing to verify that certain things work / fail as expected, but I wondered about the methodologies used (I've used unit testing in other environments, but never with C++).
My project will be split into libs, and of course I can link to the libs and call functions from there, but the GUI is projected to be contained in an exe which links to the other libs - how would I call the functions in there? Can I link to the exe (forgive the ignorance :-)
Also, do I have to use C++ as the testing language? I've recently used Python for a couple of things, and would like to use that, since I feel it would be quicker to write these kinds of tests in that language. It should be possible, because I know we can link them together, but will it be easier? Has anyone tried it?
Finally, what frameworks do people use for this? I'd prefer free, because I could have difficulty persuading my employer to spend money on this - I'm already expecting a job on my hands getting them to agree to unit testing (and automated builds, a decent bug tracking database, code reviews etc.)
I should point out that what I'm currently considering is use of either the Boost Test Library or CppUnit, if the testing must be done in C++, or PyUnit if I can use Python. Other suggestions are of course welcome! Sadly, I've not seen any mention of people using PyUnit for C++ projects anywhere, so I guess it might not be wise...
Thanks for your help!