cancel
Showing results for 
Search instead for 
Did you mean: 

script assertion

SOLVED
Highlighted
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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: script assertion

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

View solution in original post

6 REPLIES 6
Community Hero

Re: script assertion

Is this a TestComplete question or a SoapUI question?


Robert Martin
[Community Expert Group]
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
Occasional Contributor

Re: script assertion

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

View solution in original post

Community Hero

Re: script assertion

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
[Community Expert Group]
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
Occasional Contributor

Re: script assertion

Thanks so much; I'll look into it.

cheers

Occasional Visitor

Re: script assertion

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

Community Manager

Re: script assertion

Hi @Donkey2017,

 

You can find the SoapUI Pro forum here:

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

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓