Answered question

How to combine RegEx and variables in response validation?

I need to verify different responses for API calls. Call is switched between JSON and XML response record. Response should contain value previously collected from DB.

So, in JSON validated part of response looks like:


in XML validated part of response looks like:


Value "2357751" is collected from database by SQL query and it is defined unde SQL variable that is called like:


Merging validation requests to fit both XML and JSON record, validation should look like:


Since mentioned value is dynamically changed by SQL request, I have tried to post validation as:


And that is the breaking point validation has failed... I have even tried to add literal char marks to RegEx, like this:


... but no gain. Please help!

Miroslav T.
Miroslav T.

Miroslav T.

5 / 100

Hello Miroslav,

Can't you use two assertions in the whole response on that same request ? The first one based on the documentId, the second based on the ${Document_Checklist.DOCUMENT_ID}

Best Regards,
Fousseyni B.

Did you find this useful ?

No (0)

Yes (1)


100% of users found this answer useful