googlemock

GoogleMock - Matchers and MFC\ATL CString

Hey All, I asked this question on the Google Group but I think I will get a faster response on here. I'm trying to use Google's Mocking framework to test my code. I am also utilizing their test framework as well. I'm compiling in VC9. I'm having issues matching arguments that are MFC\ATL CStrings. GMock says the objects are not equal ...

Mocking non-virtual methods in C++ without editing production code?

Hello, I am a fairly new software developer currently working adding unit tests to an existing C++ project that started years ago. Due to a non-technical reason, I'm not allowed to modify any existing code. The base class of all my modules has a bunch of methods for Setting/Getting data and communicating with other modules. Since I ju...

C++ Mock/Test boost::asio::io_stream - based Asynch Handler

I've recently returned to C/C++ after years of C#. During those years I've found the value of Mocking and Unit testing. Finding resources for Mocks and Units tests in C# is trivial. WRT Mocking, not so much with C++. I would like some guidance on what others do to mock and test Asynch io_service handlers with boost. For instance, in ...

Is Google Mock a good mocking framework ?

I am pioneering unit testing efforts at my company, and need need to choose a mocking framework to use. I have never used a mocking framework before. We have already chosen Google Test, so using Google Mock would be nice. However, my initial impressions after looking at Google Mock's tutorial are: The need for re-declaring each method ...

GoogleMock and GoogleTest in Visual Studio 2010

Has anyone successfully built gmock and gtest in Visual Studio 2010? I've tried with version 1.5.0, but I only get incomprehensible compilation errors. ...

How to mock templated methods using Google Mock ?

I am very new to Google Mock and to StackOverflow, sorry in advance if my question is not well posed. I am trying to mock a templated method. Here is the class containing the method to mock : class myClass { public: virtual ~myClass() {} template<typename T> void myMethod(T param); } How can I mock the method myMethod u...

How to mock a function with the signature `object ()`

I want to mock a method with the declaration A::B X(void). The definition is something as follows. class A { class B; virtual B X() = 0; }; class A::B { public: auto_ptr<int> something; }; My mock class, following this, is quite standard. class mA : public A { public: MOCK_METHOD0(X, A::B()); }; Compiled, howev...