asserting unique ids
I would like to find sort of a "best practice" solution to this problem.
I need to have an unique id with all my requests. I have to assert that the response contains the same id.
If i make a small class that generates unique ids, i have an issue using property expansions in assertions, since one id will be sent in the request and another will be generated when i do the assertion.
I can do a script assertion but that is fiddly and takes a long time due to the various structures of the responses. I would very much like to avoid property transfers and instead have a simple method to reference the request i just sent as my expected value. Is this possible with a jsonpath match assertion somehow?
You can use property expansion to refer to the current request:
${Test Step Name#Request#<json path expression>}
For example, if the request body is
{"id": "${#TestCase#ID}"}
the assertion can refer to the request field "id" as:
${TestStep Name#Request#$.id}