Alexander Demin
unread,Jul 19, 2009, 12:05:14 PM7/19/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google C++ Testing Framework
Hi,
Some of our developers regularly ask about the possibility to log
something in the tests. They would like to do something like this:
...
EXPECT_EQ(...);
LOG() << "a custom debugging output";
...
or
LOG(2) << "a custom debugging output on level 2";
where 2 is logging level.
In the normal run of tests the LOG() macro does nothing but if needed
a developer can use '--gtest_verbose' (or --gtest_verbose=2) flag to
have that additional debug information printed to the console.
I encourage people not to do this because a test should not be in
"unfinished" state when that debug output could be useful.
Unfortunately in reality it happens sometimes when, for example, a
test is stable enough and it does what it should do but the higher
level logic is not examined properly (if, for instance, some code
talks to an external library and not all response code are fully
tested). So that LOG() output would be useful when somebody has to
come back to this test and review it again.
Just interesting how do other people manage this situation?
In terms of GTest itself the patch for this kind of feature would not
be too difficult but it is worth to know to reason of doing that in
general.
Alexander