-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
How to control scenario names? #16
Comments
Hi, Nice to hear someone other than me is using scenarios! When you say you want to modify the scenario you're in, do you mean move it to a different state? If so, then the willSetStateTo() method in the Java DSL will do the trick. The "newScenarioState" attribute in the JSON API does the same. Perhaps I'm missing what you're getting at? Cheers, |
Hi, wow - really quick response. Thanks for that. Let me shed more light on what I am after. Firstly - I am using JSON to set up my mappings. I have a facade service that is accepting a request and then calls bunch of other services fetching and updating a lot of entities. Let's say one of those calls is defined like that : { This works fine. Now I wanted to add error scenarios. One error scenario per service. { NOW. the previous mapping (I thought) would change to something like this: { and the error case would be something like this: { But that doesn't work. In fact I am now getting 404 everytime I hit the apis... Does that make things clearer? :) Thanks |
Let me take a look at that. I have a run of meetings all afternoon unfortunately, but I'll try and take a look after that. |
Thanks, again. Really appreciate it! But maybe you will be able to spot some incorrect usage of the json configuration, which would be even better ;-) |
Ah, I see now. You're right, I've completely forgotten to document this. To reset all the scenarios' state, you need to POST to |
No, no. Sorry I didn't write that clear enough. I was just saying that I thought that maybe there was something like __admin/scenarios/details to check if I have actually correctly managed to change the status. As in: |
Doh, so I did. Should read my own docs a bit more thoroughly... There isn't currently a way to interrogate a scenario's state directly. Obviously you could do it indirectly by creating stub mappings dependent on specific states and nothing else and check against those, although I admit that's a pretty messy solution. Another solution in the short term would be to run it with a debugger attached. The Longer term, I'm happy to support for this to the backlog, or accept a pull request if you fancy creating one. |
That sounds like an interesting proposal - something I might come back to you at some point. Would it be too much to ask you, for now, to test that basic JSON configuration of mine to work with scenarios and either post fixed version of it here or add to to documentation? If of course there is something wrong with those mappings I posted ... cheers |
Apologies for not having got to this yet. Day job not leaving me with much time at the moment. |
Hi, I am using Wiremock to send various success and failure responses for job requests to my application. The responses are in the form of JSONs which I have stored in 'mappings' folder. Do we have a provision in wiremock so that I can include/exclude the files I want on scenario basis? Currently I am changing the whole folder structure for every scenario that I am running and then I need to restart the server. Please let me know if we have a solution for this. Thanks, |
Unfortunately swapping out whole mappings based on scenario isn't possible. Could you give me some examples of the problem you're trying to solve? I suspect there'll be a way to make the current features work in the way you need them to. |
Hi, I started using it 2 weeks back, trying to use stateful behaviour. While is record mode, is there a way to capture stateful behaviour ? I read in the documentation that is same URL is called again, it will be ignored. |
There are lots of tools like this one, but scenario make this one unique, thanks for creating it. |
Hello! First of all, THANK YOU VERY MUCH FOR THIS AMAZING SOFTWARE! I have a problem with a stateful execution. I copied directly from http://wiremock.org/stateful-behaviour.html this code in the mappings dir: `{ { { After, I run wiremock server in standalone mode: After I execute the first scenario (GET): http://localhost:8080/todo/items I get the
Fine. After I execute http://localhost:8080/todo/items (POST) with the json object (application/json):
And I get:
And when I try to execute http://localhost:8080/todo/items (GET)
Could someone explain me where am I wrong? Thank you!!!! |
Hi @macscripter, BTW, I just discovered that inside mappings directory you can have sub-directories and they are also scanned for mapping definitions. That allows managing scenario files easier. |
Hi!
|
Hi tomakehurst, Thank you so much for all of your hard work, the Wiremock tool is awesome and it's saved us countless hours of testing! I was wondering if there is a document that shows all of the different variations of the JSON stubs. I was trying to do scenarios and didn't find what I needed until I came across this ticket. Thanks so much and keep up the awesome work! Russ Baker |
Hi,
started using wiremock couple of months ago, really speeds up development. Thank you very much for the effort!
Now that I feel more comfortable with it, I have started using it in a bit more complicated cases ... and some of them are just not solvable without the state machine.
http://wiremock.org/stateful-behaviour.html -> this is helpful, but none of the examples states how to modify the scenario you're in ... and I just cannot get this to work.
thanks in advance for any tips!
regards,
Adrian
The text was updated successfully, but these errors were encountered: