Groovy Scipting for SoapUI

Hi All,

I have just started learning SoapUI Automation using Groovy. I wondered if anybody knew of a good resource for Groovy scripting which is applicable to SoapUI / testing. A lot of the Cookbooks and tutorials are aimed at Developers.

1 Like

Hi Mark,

whether as tester or developer, knowing the basics of a programming language is helpful. You can still learn a lot about syntax, conventions, basic data structures and libraries/modules from general purpose tutorials. Depending on what sort of APIs you work with, for starters you can look into working with JSON (http://groovy-lang.org/json.html) and XML (http://groovy-lang.org/processing-xml.html) and into reading files from the system (http://docs.groovy-lang.org/latest/html/documentation/#_working_with_io). You won’t need the compiler etc. topics as SoapUI provides the environment for you.

Once you have an idea how the language works, look explicitly for SoapUI example projects/scripts on the net and play around with the samples. You may need to look deeper as a lot of features that required scripting earlier are covered by the newer pro versions of the tool (which may also reduce the initial learning load for you unless you’re past that stage already).
One example I find both eternally useful and relatively easy to play with is https://www.belatrixsf.com/blog/a-groovy-kind-of-trick-for-soapui-free-in-eight-steps/ - just going through a script and looking up things as you go, then trying to adapt it for your own project is a good learning experience. SmartBear seems to have published some sample projects as well at https://github.com/SmartBear/soapui-groovy-examples but I haven’t looked into them so can’t say how helpful they are. Even a small stepping stone can help you get ahead though.

Good luck on your Groovy adventures!

2 Likes

Personally, I find Groovy in SoapUI sucks a bit. API docs are lacking and debugging is really a pain (we’re back to console printing). Other than that it’s okay, and it can certainly do string operations, setting custom id’s, assigning and reading properties, writing files and that kind of stuff.

I agree with Magda that playing around with the language is probably a good idea to begin with.

Are you looking for aything specic? SoapUI is dated, but ubiqtous. Some of us like it for both reasons :slight_smile:

2 Likes

Hi Anders,

Thanks a lot for your reply.

To be honest, I chose Soap as it covers but Rest and Soap and Postman only covers Rest.

What do you normally use for your Service testing?

Thanks

Mark

I’ve used SoapUI to test web services manually, then wrote an automation piece in Groovy, but I don’t know how SoapUI was meant to be used after Groovy was added to it (I’m assuming they added Groovy to it later on).

The reason I say this is that it looks like SmartBear tried to encourage people to structure their SoapUI code by putting certain code in certain places - like for setup and tear down - but if you start using Groovy, you can do that in Groovy code or in those special places (they appear at the Test Case and Test Suite level (double-click on them in the left pane)). Because I’ve never used a purchased version of SoapUI, I’m just relying on the free version and the documentation out on the web.

ps I don’t use SoapUI a lot, so I’m rusty (video made in 2019).