unit-testinggoogletest

How to add timeout to test when using Google Testing framework


I'm in need to test C++ code - and I've decided to use Google's testing framework. I need to make sure that a test doesn't hang due to a new bug. In the .NET testing framework it's possible to add [Timeout] on to of the test in order to make sure that it does not run for too long.

How can I create a simialr behavior when using Google Test?


Solution

  • Google test does not offer something similar. http://code.google.com/p/googletest/issues/detail?id=348

    You would have to add this functionality in C++