Hello and good day, I have a question I have this ...
# help
r
Hello and good day, I have a question I have this proxy mapping for auto recording stubs (--record-mappings command). We use testcontainers and spin up the wiremock service then records all the stubs that is sent to this path. All the recorded stubs by default have
"ignoreArrayOrder" : true
and
"ignoreExtraElements" : true
Currently, in my code, I'm modifying the ignoredExtraElements value to false on the fly. (But seems to have issue when I am recording multiple requests on a single container run, even if the previous request has been modified to have ignoreExtraElements to false, it still prevent other succeeding requests from being recorded - that look similar but have some missing fields in req body. Is there a way to modify this during container start via a config , env, or command options? I want to have by default ignoreExtraElements to false. Sample proxy mapping:
Copy code
{
  "mappings": [
    {
      "priority": 6,
      "request": {
        "method": "ANY",
        "urlPattern": "/sample/.*"
      },
      "response": {
        "proxyBaseUrl": "<https://samplelink.sample.sample>",
        "proxyUrlPrefixToRemove": "/sample"
      }
    }
  ]
}
r
is it enough to simply modify the stub mappings after all the recording has been done?
r
That's what I currently do. But in a scenario where I run multiple tests, then some of those requests are identical (with only some missing fields), it keeps it from recording a mapping even though the stubs has been modified already to have ignoreExtraElements to false Saying
Not recording mapping for /sample/etc as this has already been received
though they differ
Is it related to ignoreExtraElements or some other factor?
r
that is unrelated to the ignoreExtraElements field. this is probably what youre looking for https://wiremock.org/docs/record-playback/#repeats-as-scenarios
👀 1
r
Do I just add it in the stub mapping on the level of ignoreExtraElements?
r
the repeatsAsScenarios property? it's a property that's set on the request to start recording. are you using the java dsl to start and stop your recordings?
r
No, I use the docker image with command --record-mappings
r
it looks like the repeatsAsScenarios property isnt available via the command line. might be a good opportunity for a contribution
👌 1
r
Quick question, if I add repeatAsScenarios in my stub mappings, will that function as intended? I did that when updating the ignoreExtraElements on each stub and didn't notice it fixing the issue I'm having
r
no, repeatAsScenarios is not a property that is defined on the stub mapping
it's a property passed to a request to start a recording
👌 1
r
Ok man. Thanks a lot for your inputs 🙌
👍 1