How to Get and Set Properties during script assertions?
I am looking for some help in order to get and set property values during a script assertion. I need to use them as part of a comparison during later steps to validate data is not changing throughout the test. The reason I am being forced to do this is that my JSON response seems to require the following import in order to parse the response:
As I am sure many of you know, this is not supported during Groovy script steps so I am kind of stuck with where to go next. I will include an exampe of the JSON response below along with what I have been trying to use so far. The assertion passes, but data is not being saved as part of the ".setPropertyValue" line of code. You will also notice that I have two different possible ways of saving the data currently included. Neither of which seem to be working as expected.
Re: How to Get and Set Properties during script assertions?
Since 'price' is variable declared here. You cannot pass it as String. Please change the code to :-
If it doesn't work. Please try this way also:-
And also, please change price variable to price1 or anything else. You already have price as jsonObject in your Json.