Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api to reset the state of a specific scenario in Wiremock? #847

Open
rampatra opened this issue Jan 10, 2018 · 7 comments
Open

Api to reset the state of a specific scenario in Wiremock? #847

rampatra opened this issue Jan 10, 2018 · 7 comments

Comments

@rampatra
Copy link

Let's say a scenario has 3 states and I want to go back to the first state if for some reasons my code (which uses the wiremock's stub) executed 2 states successfully but failed to trigger the 3rd state.

I want to go back to the first state only after some set specific time. If the 3rd state doesn't get triggered within this set time then go back to state 1.

@rampatra rampatra changed the title Is there an api to reset the state of a scenario in Wiremock? Api to reset the state of a scenario in Wiremock? Jan 10, 2018
@rampatra rampatra reopened this Jan 10, 2018
@rampatra rampatra changed the title Api to reset the state of a scenario in Wiremock? Api to reset the state of a specific scenario in Wiremock? Jan 10, 2018
@rampatra
Copy link
Author

I found a way to reset the states of all scenarios i.e, WireMock.resetAllScenarios() but couldn't find a way to reset state of any specific scenario. @tomakehurst by any chance you want to include this feature?

@tomakehurst
Copy link
Member

I've labelled this a feature request. If you'd like to raise a PR for this, it'll likely happen much sooner.

@Nyeng
Copy link

Nyeng commented Feb 27, 2019

Tried to hack around this feature by setting the last request to "newScenarioState" : "Started", but this randomly assignes the state to another previous state. If it was possible to set new scenario state back to "started" it would be easy to reset scenarios?

@CanYumusak
Copy link

@Nyeng https://github.com/tomakehurst/wiremock/pull/1046 should be the Feature Request you are looking for, right?

@kurimin
Copy link

kurimin commented Jul 6, 2020

Is there any news about the PR getting merged? Or is there any workaround at the moment to set the scenario to an specific state?

@tomakehurst
Copy link
Member

@kurimin the workaround is to create a stub on a URL that doesn't exist in the API you're mocking, and give it a nextScenarioState of STARTED. Then you just make a request that matches the stub whenever you want to reset the individual scenario.

@mjustin
Copy link

mjustin commented Nov 15, 2022

Does #1721 satisfy the requirements of this request?

@oleg-nenashev oleg-nenashev added the hacktoberfest Hacktoberfest label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants