Replies: 1 comment
-
|
@zimri-leisher is teaching me how to use ports to mimic the same behavior, using the |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TLDR: Is it possible to have the
componentmember variable of GTestBase classes be a pointer instead of an object?Hello, I would like to mock out my components, for use with Google Mock. This is so I can test that something is called versus what calling something does. Very useful for things that do system calls, IO, or other things that are hard to control in a unit test environment.
However, the "GTestBase" autocoded classes make this hard. A Tester class needs to look like
To have this be mockable, you need to be able to replace
componentwith something else, which needs a pointer:And then with google mock you can do:
Which allows you to write tests like
Very, very handy for testing that your component does what you think it's going to do, without worrying about side effects. Is this achievable with the current GTestBase pattern?
Beta Was this translation helpful? Give feedback.
All reactions