Mock class looks like this : struct MockClass { MOCK_METHOD0( foo, void () ); };
If I forget to set an expected calls on a mock object, I get something like this :
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: foo()
Stack trace:
and the stack trace is empty.
So, what has to be done in order to get the stack trace?
This is described here :
You can control how much Google Mock tells you using the --gmock_verbose=LEVEL command-line flag, where LEVEL is a string with three possible values:
1. info: Google Mock will print all informational messages, warnings, and errors (most verbose). At this setting, Google Mock will also log any calls to the ON_CALL/EXPECT_CALL macros.
2. warning: Google Mock will print both warnings and errors (less verbose). This is the default.
3. error: Google Mock will print errors only (least verbose).Alternatively, you can adjust the value of that flag from within your tests like so:
::testing::FLAGS_gmock_verbose = "error"
;
Using the info warning level will print the backtrace
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