Reputation: 189
I'm trying to write a JSONPath Match assertion for a test step in a test case in my REST project. This test step is a REST request. The response is a JSON string. Referencing the response's nodes is not a problem (in this instance I use '$..startDate').
However, for the "Expected Result" portion of this assertion, I need to reference one of the parameters of my request. This parameter is called 'date', and in the assertion I want to check if the 'startDate' node of my Json response matches 'date'.
I would have thought that something like ${#TestCase#["Start Date GET Request"]#Request#date}
would work, but it doesn't. When I test the assertion I'm told that the result for it is empty (i.e. "[]")
I tried several variations of the above.
${#Project#TestSuite#TestCase#["Start Date GET Request"]#Request#date}
${#["Start Date GET Request"]#Request#date}
${#["Start Date GET Request"]#date}
The result is always the same.
Any advice on how I can fix this?
Upvotes: 2
Views: 4742
Reputation: 18507
The notation for expected result using JSONPath must be:
${RESTRequestName#Response#$.json.path.to.date}
Use the exactly name of your testStep (without #
this is used for #TestCase
, #TestSuite
when you want to refer a property at this level, but not for properties at testStep level.
To work with the response passing a JSONPath use the $.
to start your path.
EDIT
I misunderstand your question, if you simply want the query
parameter date
use the follow notation:
${RESTRequestName#date}
As explained above, use the testStep name without #
and then since SOAPUI adds all query parameters as properties of the testStep you can access directly using it's name like you can do with Request
,Response
, and so on.
Hope this helps,
Upvotes: 2