How to use fixtures/setup without getting undefined behavior resulting from calls to mocks before EXPECT_CALL? #4261
Replies: 1 comment
-
I decided to continue this discussion in this bug: #4339 |
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
-
As the cookbook mentions it is good practice to verify one thing in one test. In order to do this, there is often some setup required before a test can perform the calls it is interested in.
The problem comes when that setup leads to calls on a mock that the test later wants to set EXPECTations on.
As the cookbook says: "gMock requires expectations to be set before the mock functions are called, otherwise the behavior is undefined."
What is the recommended way to avoid undefined behavior caused by those calls during test case setup?
Things I have considered:
Beta Was this translation helpful? Give feedback.
All reactions