Hello! I have a question about `repeatsAsScenarios...
# help
t
Hello! I have a question about
repeatsAsScenarios
option if running WireMock as standalone app in docker container. Looks like this option is set to
false
by default because in the logs I see messages like
Copy code
Not recording mapping for /some/url as this has already been received
In my case it's crucial to record and replay all such queries as a scenario. What can I do here?
r
repeatsAsScenarios
is set when you start recording. How are you putting WireMock into record mode? Using the UI, or the Java DSL, or using an HTTP client? If via an HTTP Client, try this:
Copy code
POST /__admin/recordings/start
{
  "targetBaseUrl": "<http://example.mocklab.io>",
  "repeatsAsScenarios": true
}
t
I simply pass
--record-mappings
options as a parameter to the docker container
Copy code
fusion_wiremock:
    image: wiremock/wiremock:latest
    ports:
      - 8080:8080
      - 8443:8443
    volumes:
      - ./wiremock-recordings:/home/wiremock
    command: ['--verbose', '--https-port=8443', '--print-all-network-traffic', '--record-mappings', '--proxy-all=<https://someurl>']
Am I understand correctly that such things could be controlled only by HTTP requests to WireMock instance?
r
Ah, I see - I'd forgotten you can set that. Let me look into it.
I think if you want more control over the behaviour you'll need to use the JSON API instead of just setting the command. There's no way to control the
--record-mappings
option beyond what you've used. See https://wiremock.org/docs/record-playback/
t
Ok. Thank you.
Is it worth to create an issue about such improvements or no one before was interested in that?
r
The startup command line option is scheduled for removal, so I’m afraid not
t
Good to know😀
And in UI we also can't specify those options? Only by request to API?
r
That’s right
t
@Rob Elliot on little extra question. If I need to set
repeatsAsScenarios
without starting of new recording. Which endpoint shall I call?
r
You can't, as such. You should start WireMock without
'--record-mappings', '--proxy-all=<https://someurl>'
and then make the HTTP request:
Copy code
POST /__admin/recordings/start
{
  "targetBaseUrl": "<http://example.mocklab.io>",
  "repeatsAsScenarios": true
}
t
I think my question is just about reset of the scenario.
r
I don't know I'm afraid - not sure I fully understand what you're looking for?
t
I'm sure now. My problem was because the scenario shall be reset after run to be repeated.
Thanks