Howto solve this steps order problem #2778
Replies: 2 comments 3 replies
-
|
Do you have a reference on how you would do this in say a JUnit test? I am trying to understand the flow better. In my head, mocks typically need to be set before passing it to the test subject. A retrospective mock may not be visible, so I don't know if this is a problem with gauge steps or the way the mocks are setup. |
Beta Was this translation helpful? Give feedback.
-
|
IMHO mocking is more of a given/when/then style of traditional gherkin/bdd style testing and is typically not something I'd try and do with something like gauge, because your step definitions and ordering are likely to broadly end up mirroring the mocks, if you make them as fine grained as your example. There's nothing to stop you expressing steps this way with Gauge so you set up expectations prior to sending but it's unlikely to feel idiomatic to gauge, and you'd probably need to be storing the mock in the state and retrieving it in later steps to perform verifications coupled with earlier mock setup. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have defined the following test:
I have the following implementation:
The problem is that the implementation of the
httpClientWithCache.sendRequest(...)deals with some states of the response. Those states are mocked in the steps that follow the sending of the request, too late for thesendRequestalgorithm logic.What's the best way to set up the response mock before sending the request, while keeping an idiomatic and logical way to define the test steps? I logically don't want to define the state of the response before sending the request in my specification…
Beta Was this translation helpful? Give feedback.
All reactions