Using Google Test 1.6 (Windows 7, Visual Studio C++). How can I turn off a given test? (aka how can I prevent a test from running). Is there anything I can do besides commenting out the whole test?
标签:
googletest
相关问题
- Google Test - generate values for template class i
- Googletest Parametrized tests crash
- Improving the build times for Google Test test cas
- Add delay to gtest Test Case
- Unit test from google test no longer found after a
相关文章
- How to mock methods return object with deleted cop
- GoogleTest: Accessing the Environment from a Test
- SEH exception with code 0xc0000005 thrown in the t
- find_package does not find GTest which is part of
- How to mock method with optional parameter in Goog
- How to catch an assert with Google test?
- How to compile Google Test using IAR compiler for
- How to pretty-print QString with GoogleTest framew
I had the same need for conditional tests, and I figured out a good workaround. I defined a macro TEST_C that works like a TEST_F macro, but it has a third parameter, which is a boolean expression, evaluated runtime in main.cpp BEFORE the tests are started. Tests that evaluate false are not executed. The macro is ugly, but it look like:
Additionally, in your main.cpp, you need this loop to exclude the tests that evaluate false:
The docs for Google Test 1.7 suggest:
"If you have a broken test that you cannot fix right away, you can add the DISABLED_ prefix to its name. This will exclude it from execution."
Examples: