googlemock Questions

1

Solved

Is it possible with gmock to mock a function which contains a class template parameter in it's signature? For example: template <typename T> struct Mockable { virtual void do_work(const int...
Ferd asked 13/8, 2013 at 6:26

1

I am using google mock to unit test my code, and I am trying to return, as an output argument, a set of values through a void*. uint32_t bigEndianTestValues[BIG_ENDIAN_FIELD_MAX_ELEMENTS] = {0xDEA...
Buran asked 24/7, 2013 at 21:35

1

Solved

I have class to be mocked but it does not have a default constructor. I cannot change the source code, so is there any way to mock a parametrized constructor using Gmock
Accountancy asked 4/7, 2013 at 8:24

1

Solved

I have a class that takes a boolean as a reference parameter and returns an integer: class Foo { public: Bar my_bar; virtual int myMethod(bool &my_boolean) = 0; } /*...*/ int Foo::myMetho...
Interstitial asked 21/6, 2013 at 16:11

1

I have a problem matching a function argument to a specific object using google mock. Consider the following code: class Foo { public: struct Bar { int foobar; } void myMethod(const Bar&amp...
Swede asked 21/6, 2013 at 10:13

1

Solved

I've written a small test with a mocked class. When I run it, first I get the warning that an uninteresting mock function was called and then the test fails because the expectation is not met, whic...
Thersathersites asked 12/6, 2013 at 8:30

2

Solved

I'm trying to write mock for a class which contains three overloaded methods, ie.: #include <gtest/gtest.h> #include <gmock/gmock.h> using ::testing::_; using ::testing::Return; using...
Epicardium asked 10/5, 2013 at 10:11

3

I am trying to Google mock a virtual method which has a throw() specifier. The original function looks like this: virtual ReturnValue FunctionName() const throw(); I am getting the compiler err...
Unhandsome asked 7/2, 2011 at 14:46

1

Solved

I am planning on using Google Mock. I need to capture an object reference so that I can subsequently call some methods from that object. Does Google Mock have any capturing abilities? If not, what...
Achromatous asked 24/4, 2013 at 19:39

1

Solved

In case of match failure Google mock prints message like the following: test.cpp:112: EXPECT_CALL(mock_obj, foo( MyMatcher( bar ) ))... Expected arg #0: is equal to [1,2; 3,4] Actual: { 1 } E...
Gormless asked 11/3, 2013 at 21:35

2

Solved

In our application we use several dynamically linked libraries. We recently updated the version of one of these libraries. The developers of that library are providing a main method since this new ...
Wealthy asked 14/3, 2012 at 9:13

2

I am novice to googlemock. My current project needs googlemock to use. I have learned from basics of gmock from google help site. But when I have tried to implement the same in my project it ...
Salters asked 28/12, 2012 at 10:9

1

How to invoke two different functions when a mocked function is called in the tested function in "Test suite"? Details: A mocked function is called twice in a tested function. When it is called t...
Marvel asked 30/11, 2012 at 8:30

1

Solved

gmock does not support rvalue reference as parameter of mocked function (issue report). For example the following code will not compile: MOCK_METHOD1(foo,void(std::string&&)); I can't f...
Jesher asked 23/8, 2012 at 9:22

2

I'm using Google Mock for my project, and the instructions say it's better to build the library along with the project, because different compiler flags can introduce bugs. I don't want to add the ...
Hypomania asked 12/8, 2012 at 9:15

1

Solved

I want to assign a NiceMock with the return value of a method. The NiceMock is an instance variable. class TestFileToOsg : public testing::Test { public: NiceMock<MockFileToOsg>* _mockFile...
Homosexual asked 26/6, 2012 at 9:34

2

I have a test that works fine with a raw pointer, but I'm having trouble getting it work with a std::shared_ptr. The class is like this: class MyClass { MyClass(SomeService *service); void DoIt(...
Heti asked 26/4, 2012 at 21:34

1

Solved

I use GoogleMock/GoogleTest for testing, and I'm seeing some strange behavior when a matcher has a shared_ptr to a mock as a parameter, and EXPECT is called on the same shared_ptr. The offending pi...
Donoghue asked 23/4, 2012 at 18:56

1

Solved

I'm developing code that uses boost::asio. To test it, I need to mock a set of classes from this library. I'm using Google Mock, which allows for mocking virtual methods. The usual (and tedious) pr...
Palliate asked 21/4, 2012 at 15:43

2

Solved

Using GMock, how can I verify that a class's destructor is called? Is there a way, other than to wrap it in another class? The obvious method, EXPECT_CALL(object, ~classtype()) yields a compiler e...
Rhee asked 19/1, 2011 at 11:23

2

Solved

I am using gmock for unit testing C++ code. I am not using the gtest framework. I am using visual studio 2008's built-in testing framework. Now my problem is that I have to manually write mock cla...
Cryptogam asked 13/2, 2012 at 7:1

2

Solved

I am using gmock in my project and I meet a problem to set a custom reference variable for a mock function. Suppose I have a class as following: class XXXClient { public: void QueryXXX(const Req...
Norty asked 13/1, 2012 at 3:59

3

Currently my project is composed of various concrete classes. Now as I'm getting into unit testing it looks like I'm supposed to create an interface for each and every class (effectively doubling t...
Cranford asked 8/7, 2011 at 1:41

2

Solved

Using Visual Studio 2010 C++ with googlemock. I'm trying to use a mock I created and I'm getting the compiler error on the line: EmployeeFake employeeStub; The error is: 1>c:\someclasstests....
Outgoings asked 5/7, 2011 at 23:56

2

Solved

Using Visual Studio 2010 C++ with GMock. Trying to create a stub object for a third party class that is used by my classes but I'm getting the following error: Error: object of abstract class ty...
Creativity asked 29/6, 2011 at 23:47

© 2022 - 2024 — McMap. All rights reserved.