I recently read a programming book that has a good piece of advice in it: "Find Bugs Once". The idea is, whenever a bug is reported, write a unit test that correctly detects the bug and fails. Then if a regression occurs and the bug resurfaces, it will be caught immediately by the test rig.
Our testing setup should be pretty easy to automate. I'm thinking about running tests nightly on the main development branch (currently trunk). I think I can make it output a web page that displays which tests failed (if any), and the details of the failure. If anyone has suggestions for the best way to implement this, please post them.
Of course, this will only work if tests actually get written. I will try to write some more tests for classes that don't have any yet. I won't be able to test every class on my own, however...so is anyone interested in helping with writing more tests?
edit: I should have mentioned this more clearly, but I wrote a new SCons builder to automatically build a test rig for VDrift. Might as well use this thread (so I modified the title) to talk about testing in general. I wrote a new file (
src/unittest.cpp) for the build that has a simple main() that runs the tests. To build the test rig, do:
More information can be found here:
http://wiki.vdrift.net/Testing