Behdad
5 years agoContributor
Script assertion to find string value in response
Hi
I am using ReadyApi. I have Rest api with below json response
{
"check_customer_transnr" : "01ERYER76ABPNSY247Y4W4C4AM",
"card_token" : false,
"email_address" : false,
"telephone" : false
}
I am not good at scripting , but i need to have Script Assertion with following control
1- control if key "check_customer_transnr" exist or not ?
2- if the key "check_customer_transnr" exist is the value is empty string "" or not ? ( find out how much is the length of the value)
3- find out the value of "email_address" if it is True
and after each of control/conditions 2 (empty value) or 3(email value is true), i need to set assertion to FAIL.
I try to write script for it ...but cant manage , so i would be appreciate if you can help on it.