Ask a Question

script assertion

SOLVED
Donkey2017
Occasional Contributor

script assertion

Hi, not being a programmer could anyone suggest a way to check if the property "apples" has a number rather than just null for example. So below is the result of running a test. I can easily ask SOAP to check if there is an item called "apples" but I have no idea how to ask if "apples" equals a numerical value- any value not just 111.

{
   "CONTENT":    {

      "apples": 111,

   },

 

thanks

 

6 REPLIES 6
tristaanogre
Esteemed Contributor

Is this a TestComplete question or a SoapUI question?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Donkey2017
Occasional Contributor

Hi, thanks for the reply and since you have asked that question I suspect my question is a SOAP UI issue and so I posted to the wrong section (I think)

 

cheers

Just a matter of what tool you're using.  If you're using TestComplete to exercise this test case, then you're in the right place.  If you're using TestComplete to launch a SoapUI test, you might need to check with the SoapUI folks to see if they know better.

 

For my part... that text content reads like JSON to me where you have an object with a property called "CONTENT" which consists of another object with a property of "Apples" which has a value of 111.

 

SO.... what I would do in TestComplete is use the JSON.Parse method to parse that set of text into JavaScript objects and then just do a logic like

 

if (CONTENT.Apples != '111') Log.Error('Nope');


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Donkey2017
Occasional Contributor

Thanks so much; I'll look into it.

cheers

Richard154
Occasional Visitor

Script Assertion technique is the most widely used technique since managing and maintaining hundreds of assertions are quite difficult for a long response message walgreenslistens

TanyaYatskovska
SmartBear Alumni (Retired)

Hi @Donkey2017,

 

You can find the SoapUI Pro forum here:

https://community.smartbear.com/t5/SoapUI-Pro/bd-p/SoapUING_forum

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: