New method :isCallExpected #1748
MichalMotyl
started this conversation in
Ideas
Replies: 1 comment
-
I have some something similar but have used setData for that to set a boolean that I would check in the mock. Using "isCallExpected" feels off since it could be that you didn't expect a call and that is a failure... but you might not notice that anymore when you do it the suggested way. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi.
I'm working on embedded project , esp32 based, c++written.
I started implement unit tests and I decided to use Cpputest library because its low footprint.
During my work with UT's I wanted to avoid/limit creating mock classes for some test cases and have choice to call mocked
method or the real implementation. The idea is showed below:
class A {
public:
A(){};
virtual ~A(){};
virtual bool foo(){
return false;
}
}
class B : public A{
public:
B(){};
~B(){};
bool foo2(){return foo()};
}
Then in UT code we could do this:
Case when we want call mocked method:
...
B *x = new B();
x->foo2();
Case when we want call real method doesn't require anything. Jut call x->foo();
What do you thing about the idea?
Beta Was this translation helpful? Give feedback.
All reactions