soapUI Test Automation Framework – How?

Posted: October 19, 2011 in soapUI
Tags: , , , , , ,

In recent past, many folks asked me about pointers/ideas to design the Test Automation framework in soapUI. Well sharing this knowledge would be like a digging a grave for self πŸ˜‰ however if everybody would start thinking like this then the flow of knowledge would stop πŸ™‚

So here i share some very basic idea + pointers on designing the Test Automation framework. Before we start of with that, couple of things which should be considered/factored :

  • Amount of effort you want to put-in or resource
  • High Extensibility + Low Maintainability
  • Ease of Use
  • Know-How of Groovy script
  • Decide upon input files type & output files

I have decided to go with XLS as input file & TXT as output file.

Do the following :

  • For every Method/Operation in your Interface/API, maintain a corresponding sheet in XLS + a Master Sheet.
  • Each sheet will contain all the possible input variables (as row) for the respective method/operation.
  • And the Master Sheet which will contain information about each sheet (like #variables, #input, #row, #col etc)
  • All the input data for those variables would be stored in respective columns (Col 1, Col 2, Col 3…)
  • Write a script (should be the placed before all test steps) to perform following task :
  1. read each sheet one by one
  2. for every row/variable (taken from mastersheet) in a sheet create a respective custom property (with same name as in XLS) in user-defined property teststep.
  3. run the loop for n times, where n= myCounter (value taken from master sheet)
  • All the methods/operation (as teststep should appear here) with parameterized input based on the property values from user-defined property teststep. Also, don’t forget to put required assertion to identify the teststep status (Success/Failed).
  • Script to store the Raw Request & Response at the specified location.
  • Write another script (should be placed after all test steps) to loop through all the test steps again till a condition fails (like count > myCounter) or a simple data source (& loop) teststep can be used with defining the number of iteration.

Snapshots of the Mastersheet, Input XLS files & soapUI testcase structure :


Method 2 Input Sheet

Method 3 Input sheet

Automation Framework - Test structure in soapUI

Comments & Feedback are always welcome πŸ™‚ Till next blog Happy reading & sharing!!

NOTE : I didn’t bother much about points mentioned above & prefer to go with the flow of work. It’s just that i am working on my daily activity + designing this framework. This is one of the easiest way to create a soapUI test automation framework.

  1. Aaron says:

    hi [pb], i need a cmd file to launch soapui automation when to run some cases. could you provide a sample for this? thx in advance~~~i knew the soapui will automatically generate the cmd line, but i just have a separate file to store in local or server.

  2. Hi Aaron,

    going by my understanding to your question :
    execution of the your automation project xml can be done using the testrunner.bat file. And as you correctly mention, soapui do the same while performing the test execution.

    project file can be located at any remote location, provided it is accessible.

    /pradeep bishnoi

  3. Aaron says:

    thank you. I have resolved the matter. sorry….I have another question, I am not sure if there is a way to save the special characters in soapUI. before, I have a piece of message including hexadecimal character, unfortunately, if I save the project, the special characters will be changed into question mark(?). please let me know if we can keep it? thanks in advance

  4. James Irlbeck says:

    Write a script (should be the placed before all test steps) to perform following task : each sheet one by one
    2.for every row/variable (taken from mastersheet) in a sheet create a respective custom property (with same name as in XLS) in user-defined property teststep. the loop for n times, where n= myCounter (value taken from master sheet)

    This sounds like a very cool approach. If you could please post your script I or email it to me I would be grateful. I’ve been working with SoapUI for about 2 months and have made great progress but this would be a huge leap forward.

    Thanks!! –

  5. Shailaja says:

    Hi Pradeep,
    I am newbie to SOAP UI pro and have tried to run my test suite from command line but for some reasons the cdata parsing is not happening from command line and hence my test cases are failing.

    I have used SudmitListener.afterSubmit event
    if( submit.response == null )
    def content = submit.response.responseContent
    content = content.replaceAll( “”, “” ) content )
    submit.response.responseContent = content

    This works(CData parsing is happening and property transfer is successful) when i run from soap UI editor.

    Can you please advise me on this issue.

    • Hi Shailaja,

      This seems like a problem & i never tried it in past.
      This listener event is not getting called hence no transformation & transfer of data. If you will check the results so saved after TestRunner execution it will have CDATA response.

      Need to check with SmartBear (eviware) team.

      {Pradeep Bishnoi}

  6. prashanth says:

    Hello Pradeep,

    I have been using Soap UI since a month. It has been a great experience so far. I have also been following your blogs and It has been really great I should say.
    Currently, I trying to build a framework where we should be able to read values from an excel sheet.
    Is there any script which I can make use of. Can you please help me in this regard.

    Thanks in advance

    • Thanks for sharing your feedback, Prashanth.
      Reading excel using groovy has been shared in one of the past blog post and it’s just a matter of handling the row,column to get the things done.
      This can be done using the nested loop & hope i will be able to share the code in near future.

      {Pradeep Bishnoi}

  7. bala says:

    Hi, I am trying to exit soapui execution after my first assertion is failed through groovy. Tried with System.exit(1) which did not stop. Any clues?

  8. QAAutomation says:

    Hi Pradeep,

    New to the tool but not new to the automation framework using QTP. So did like your soapui automation framework concept, but being new to Groovy handicapped on my progress. Any ways if you can please post your groovy test steps details i.e. code.

    Also if any more updates on your framework that can be shared.

    • Hi,

      Hopefully, i will be able to share the same in near future.
      So for time being, just rely on the nick-pick code snippets shared in blogs πŸ™‚
      {Pradeep Bishnoi}

  9. Prabhakar Reddy says:

    Hi, Thanks for a providing good blog

  10. Andrew says:

    Hi, Thanks for this post. I’ve implemented something like it. In my implementation I have each method setup as a testcase and a master TestRunner testcase which runs the others. I use scripts, and dataSouces teststeps to read in data specific to the method and create dynamic requests.

    It’s working really well for adding data to our system, however, I’m at the point where I’d like to try some asserts (currently I just assert valid SOAP response). I’d like to start with basic stuff like checking for SOAP Faults. This is a little tricky for me since my testcases are very generic and can be used for tests which produce expected passes as well as expected failures.

    I’m thinking I’ll have to dynamically add the assertions to each testcase using scripting or have a double testcase for each method. One for expected passes and one for expected failures. Not sure which way to go?

    How and where are you doing asserts in your example?

    Thanks in advance.

  11. shekar says:


    While executing soapUI request, I got an error :

    2013:ERROR:Exception in request: Address family not supported by protocol family: connect

    Can anybody please let me know how to resolve this error ??? Thanks in advance

Leave a Reply

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

You are commenting using your 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