Solved
Forum Discussion
divergentor
9 years agoOccasional Contributor
Hello, Helen.
I thought about it as a first solution.
But I need customer property to be incremented.
I couldn't find any option to increment value from JSONpath.
That is why i decided that Script Assertion will be the best solution.
For now I did it by adding one additional Script step, in which I take customer property, increment it and write back.
Then I take it and compare as you show.
But I want to use javascript because it can simplify a lot of things.
SoapUI 5.3 uses an older version of the Rhino engine (1.7R2) that does not support JSON.parse(), but there are a couple of workarounds.
Option 1: use eval()
var str = '{"foo": "bar"}'; var obj = eval('(' + str + ')'); log.info(obj.foo);
Option 2: Update Rhino engine and use JSON.parse()
- Download the latest version of Rhino from here:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Download_Rhino - In the <SoapUI>\lib folder, replace js-1.7R2.jar with js-<ver>.jar from the downloaded archive.
- Restart SoapUI.
Now you can use JSON.parse():
var str = '{"foo": "bar"}'; var obj = JSON.parse(str); log.info(obj.foo);
- rupert_anderson9 years agoValued Contributor
Nice one - great answer! :-)