Hi. Is there a way to generate some random string ...
# help
r
Hi. Is there a way to generate some random string matching particular pattern using
response-template
? eg:
[A-Z]{3}[0-9]{5}
should produce ABC12345, XYZ54321 etc
r
for the pattern in your query, you can do
{{randomValue length=3 type='ALPHABETIC'}}{{randomValue length=5 type='NUMERIC'}}
r
Great. TY @Rafe Arnold
🙏 1
r
more docs on wiremock's random helpers is here
🙏 1
r
Need one more help. The Stub i created always returns 200 response. Is there a way to arbitrarily send some failure response like 400, 404, 500 etc.
r
there is currently no way to have the same stub return different statuses. you can have multiple stubs that each return a different status and have each one match based on some detail of the request, say
/thing/1
returns a 200 whereas
/thing/2
will return a 404
fyi wiremock cloud supports this exact feature out of the box using the chaos feature.