cancel
Showing results for 
Search instead for 
Did you mean: 

Script assertion to find string value in response

Behdad
Occasional Contributor

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.

2 REPLIES 2
sonya_m
Community Manager

Re: Script assertion to find string value in response

Thank you for your post!

 

Let's see if our scripting pros can help🙂

 

@msiadak @HimanshuTayal @nmrao @ChrisA , could you look into this? Perhaps you'll be able to come up with a script!


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
ChrisA
Contributor

Re: Script assertion to find string value in response

Hi Behdad,

 

Would you like to share what you have so far?

 

Chris

 

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors