I am using gtest to write unit tests for my application. I also have ctest that runs all executables added by add_test CMake command. Is it possible to pass gtest variables through ctest when test execution starts?
I would like to for example sometimes filter out tests with --gtest_filter flag but I don't know how or if this is even possible through ctest? I have tried the following ways:
ctest --gtest_filter=AppTest.*
ctest --test-arguments="--gtest_filter=AppTest.*"
But both still run all tests instead the filtered ones.
Thanks!
For example, to make tests' output verbose:
$ make test ARGS="-V"
To run a particular test:
$ ctest -R <regex>
NB: You can have a look at this for some examples.
Take a look at CMakes's add_test
add_test.
To filter out tests from CTest you can use -L ctest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With