Using CTest to standardize testing in CMake
Ultimately, automated testing involves nothing other than running an executable that sets your system under test (or SUT) in a given state, performs tested operations, and checks if the results match expectations. You can think of them as a codified way of filling the blanks in the sentence "GIVEN _ WHEN _ THEN _" and checking if it's true for SUT. As you can imagine, there's more than one way of doing this—actually, there are lots. Everything depends on the kind of framework you're going to use, how you are hooking it up to your SUT, and what is the exact configuration. Even things as minuscule as the filename of your testing binary will impact the experience of the person using your software. As there are no agreed-upon standards to these things, one developer will use the name test_my_app
, another will go with unit_tests
, and a third will use something obscure or not provide tests at all. Discovering which...