abgo
15 years agoNew Contributor
How to retrieve property value in groovy script
I have been trying to retrieve property value in a groovy assertion script. Execution of my test case is as follow
1) Connect to DB and retireve values
2) Transfer the values to properties using property transfer
3) Run the WS request and validate response against the properties in previous step.
I have successfully used XPATH assertion for content but the problem begins when the data is null. Database, although return null values, the property transfer modify it to an empty string and the XPATH assertion fails and I get the following error:
I thought the workaround to this could be to parse the values in groovy script and then compare it but I can't seem to figure out how to access property values transferred in previous step.
Any suggestions welcome.
thanks,
abgo
1) Connect to DB and retireve values
2) Transfer the values to properties using property transfer
3) Run the WS request and validate response against the properties in previous step.
I have successfully used XPATH assertion for content but the problem begins when the data is null. Database, although return null values, the property transfer modify it to an empty string and the XPATH assertion fails and I get the following error:
XPathContains comparison failed, expecting [], actual was [null]
I thought the workaround to this could be to parse the values in groovy script and then compare it but I can't seem to figure out how to access property values transferred in previous step.
Any suggestions welcome.
thanks,
abgo