I've just spent some time figuring out the following error message
: error: Uninteresting mock function call - returning default value.
Function call: get_rootElementName()
The mock function has no default action set, and its return type
has no defa
ult value set.
": error:" prefix is not the warning about Uninteresting function
documentation promises us, but it is less than obvious from the
message that first two lines should be skipped and the text "The mock
function has no default action ..." is the problem to address. If
"uniteresting funciton" part cannot be printed outside ": error:"
prefixed text it would be good to have something like "Assertion
failed" before actual text that describes the failure. That would save
some time at least for noobs like myself.
Otherwise I like the tool so far.
Thanks.
Google Mock has a built-in default action for any function that returns void, bool, a numeric value, or a pointer.
To customize the default action for functions with return type T globally:
using ::testing::DefaultValue;
DefaultValue<T>::Set(value); // Sets the default value to be returned.
// ... use the mocks ...
DefaultValue<T>::Clear(); // Resets the default value.
To customize the default action for a particular method, use ON_CALL():
ON_CALL(mock_object, method(matchers))
.With(multi_argument_matcher) ?
.WillByDefault(action);
Hello,I know that it has been over three years since your post, but if you are still active in the group, I would appreciate knowing how you resolved "The mock function has no default action set" issue. I am seeing the same issue on my first attempt at mocking.I thought that the EXPECT_CALL macro would tell gmock that I AM interested in that call. I have tried each of the following; both return the same error.EXPECT_CALL(myObject, MethodName(pAbsCmd, nErrorCode)).Times(1);EXPECT_CALL(myObject, MethodName(pAbsCmd, nErrorCode)).WillOnce(Return(PositiveResponse));Thanks in advance,Richard F. Johnson
--
---
You received this message because you are subscribed to the Google Groups "Google C++ Mocking Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlemock+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.