Introducing Soapy – a helper lib for SoapUI

Hi All,

This project is really an immature one, with a mixture of Java and Groovy, lacking loads of the documentation, so use it at your own risk 🙂
After those few words of encouragement I must say that actually without this lib my friendship with SoapUI would end months ago.
I don’t have much time to describe what kind of stuff you can find in there, so please explore the src code. There’s one example at the end of this post that I find pretty useful.
The best thing is that you can use it with the free version of SoapUI.

As mentioned before, many classes are still missing a decent documentation, but I’m still hoping that one day everything will better and sun will shine for all of us!
Before asking any questions, please read the README.md file and/or read the code itself 🙂

To compile the project you’ll need:

  • Git
  • Java
  • & Maven

Once the build process is done, simply put the soapy-1.0.jar from ./target directory to your SoapUI/bin/ext folder, then restart the SoapUI.
If everything went fine, then you should see a similar entry in soapUI log:

Fri Oct 05 16:41:03 BST 2012:INFO:Adding [/home/jk7/git/soapui-runner/soapui-4.5.1/bin/ext/soapy-1.0.jar] to extensions classpath

To make any use of it, import any Soapy class into your script step or script assertion:

import com.yelllabs.soapy.”name.of.the.class”

Ahh… I almost forgot, here’s the link to my Soapy project on GitHub 🙂

Cheers,
J

How to parse and handle a JSON response:

import com.yelllabs.soapy.helpers.Response;
import com.yelllabs.soapy.json.JSONHandler;

Response r = new Response( context, testRunner, log, "nameOfTheStepWithJSONResponse" );
JSONHandler jh = new JSONHandler( log );
Object json = jh.parse( r.getRawResponse() );
// validate the JSON 
jh.isValid(json); 
jh.isObject(json);

// then to access any element, simply:
json.elementName.arrayName[positionInArray].etc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s