Top "Googlemock" questions

Designed with C++'s specifics in mind, Google C++ Mocking Framework (or Google Mock for short) is a library for writing and using C++ mock classes.

How can I tell GoogleMock to stop checking an expectation after the test finished?

I have two unit tests that share some state (unfortunately I can't change this since the point is to test …

c++ unit-testing googletest googlemock
How to make a mock object throw an exception in Google Mock?

With Google Mock 1.7.0, I have a mock object with a method, and I want to expect it to be called, …

c++ unit-testing exception throw googlemock
C++ Google Mock SaveArg : how to save a pointer argument

I having difficulty saving a pointer argument that my mock receives. #define SIZE_OF_DATA typedef struct { uint32_t someValue1; …

c++ googlemock
google mock - can I call EXPECT_CALL multiple times on same mock object?

If I call EXPECT_CALL twice on the same mock object in the same TEST_F . . . what happens? Are the …

c++ unit-testing googletest gmock googlemock
Calling a method when expected method on mock was invoked

I have the following scenario: class InterfaceA; class InterfaceB; class InterfaceC; class InterfaceA { virtual void foo(InterfaceC&) = 0; }; class InterfaceB { …

mocking googlemock expectations
Passing arbitrary arguments to invocked methods with Google C++ Mocking Framework (Google Mock) (V1.5)

I have a mock method. When it is called, I'd like it to call another function before calling its normal …

c++ unit-testing parameters mocking googlemock
Using Google Mocks, how to give a mock implementation without caring about / setting any expectation of invocation

I have an interface class say: class MyInterface { public: virtual int doThing(int x, int y, int z) = 0; }; I want …

c++ unit-testing googlemock
Google Mock: multiple expectations on same function with different parameters

Consider the case where a certain mocked function is expected to be called several times, each time with a different …

googletest gmock googlemock
Google Mock: why NiceMock does not ignore unexpected calls?

I am using Google Mock 1.7.0 with Google Test 1.7.0. The problem is when I use NiceMock I get test failures because …

c++ unit-testing googletest googlemock
Why can't I use SetArgPointee() with googlemock?

I am trying to set an "out" parameter on a mock with SetArgPointee. Here's the code I'm testing: DWORD bodysize = 1024; …

c++ unit-testing googlemock