I'm using GNU autotools for the build system on a particular project. I want to start writing automated tests for verifcation. I would like to just type "make check" to have it automatically run these. My project is in C++, although I am still curious about writing automated tests for other languages as well.
Is this compatible with pretty much every unit testing framework out there (I was thinking of using cppunit)? How do I hook these unit testing frameworks into make check? Can I make sure that I don't require the unit test software to be installed to be able to configure and build the rest of the project?
Best Answer
To make test run when you issue
make check
, you need to add them to theTESTS
variableAssuming you've already built the executable that runs the unit tests, you just add the name of the executable to the TESTS variable like this:
It should then be automatically run when you
make check
, and if the executable returns a non-zero value, it will report that as a test failure. If you have multiple unit test executables, just list them all in theTESTS
variable:and they will all get run.