1

I am trying to GMOCK a class:

class A
{
public:

void method1()
{
std::cout << "Called" << std::endl;
}
};

class B : public A
{
public:
void method1()
{
............
A::method1();
............
}
};

How can I write test case for class B method1 to call mock method of class A method1 when referred in the flow? Hence B's method1 should be called upon but when it needs to call A's method1 - it should instead call mock method and continue.

273K
  • 29,503
  • 10
  • 41
  • 64
Programmer
  • 8,303
  • 23
  • 78
  • 162
  • https://stackoverflow.com/questions/8942330/google-mock-unit-testing-static-methods-c – Asesh Sep 03 '17 at 07:40
  • I have removed static qualifier - the issue is that in between B's method2 call A's method is invoked - hence I want to mocK A's method only remaining should execute B's method2 – Programmer Sep 03 '17 at 07:45

0 Answers0