How to assert for a "not null" response in the json response from soap api?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018
08:01 AM
07-03-2018
08:01 AM
How to assert for a "not null" response in the json response from soap api?
How to assert for a "not null" response in the json response from soap api using groovy scripting
Solved! Go to Solution.
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018
11:10 AM
07-03-2018
11:10 AM
You can try something like this snippet of code, that asserts that the repsonse is not null, is not an empty collection, and is not an empty string:
def response = context.expand( '${TestStepName#Response}' ) assert (response != null) && (response != "") && (response != []);
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
10:14 AM
07-05-2018
10:14 AM
You can do this in script assertion by writing below code:
def response = messageExchange.getResponseContent()
assert (response != null) && (response != "") && (response != []):"Assertion failed, Got Null Response"
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
