Forum Discussion

PramodYadav's avatar
7 years ago

Building awesome frameworks in SoapUI !

We have build an awesome framework in SoapUI using heavy groovy scripting. Since much of it was learned over time from internet, we feel its our time to show our gratitude and give back to community.  


What we have found is you can pretty much achieve anything and everything that you need in your project, using Groovy scripting.


In this thread, I will share some of the cool things we achieved and some tips-tricks/code snippets to get you interested in exploring the power of groovy. I would also like to invite you to share your tips-tricks-questions in comments below. So here are some of the elements of our framework:

  1. Achieving data driven framework to run any number of input files in one run.
  2. Reading input files from external files and parse them into web service requests for each run.
  3. Ability to capture results of each script and store them in external log files.
  4. Ability to pass variables/list/arrays across multiple scripts (without use of inbuilt transfer variables).
  5. Ability to do all assertions in the code (without use of inbuilt assertions).
  6. Ability to assert xml input/outputs with real time database values (DB2/tandem/Oracle)
  7. Ability to trigger ftp tools via command line.
  8. Ability to invoke excel macros via command line.
  9. Able to trigger mainframe macros and submit jobs from Command line.
  10. Reading ini files to keep sensitive ID/PWD information separate from framework.
  11. Run time test folders creation to store test results for each run based on a TC name/date timestamp.
  12. and much more...

If you are curious to know more about any of these aspects, do let know in comments below. If you have some tricks up your sleeve, I will be happy to learn them from you. If you have a problem statement bothering you and you see similarities above, do ask here. May be I or someone in community have an answer?


Happy learning!

Regards Pramod


P.S: Special thanks to Mr @nmrao , who made my initial experience here in this community a memorable ones (when I started somewhere last year). Although we have only few questions to and fro, but you truly are doing a remarkable work helping folks in need :). Thank you.



6 Replies

  • Can you please help me with comparing XML response which has some 1l lines with jdbc response . Can you please give overview on it
    • PramodYadav's avatar

      The question is a little wage but if I understand the gist of your question, you want to compare the xml response of service with corresponding data stored in DB2 tables - right?


      If so, Parse the o/p using xmlparser and store it in say an array (you can find ways to do it on internet). Write the sql statement for the expected o/p in table, and create a list using this sql statement. Something like below :


      ' First register the JDBC driver in a grooy scipt as:"" )  ' Ofcourse i assume you have already placed a db2 driver in this  folder " programfiles -> smartbear -> soapui your version -> bin -ext (if not copy paste one)


      sql = Sql.newInstance(" jdbc:db2://servername : portnr/DBName,yourusername,yourpwd,"com/ibm.db2.jcc.db2Driver"  );

      sqlTBname = " select * from ...whatever" 

      listsTBname  =sql.rows(sqlTBname)


      Now, you can assert the elements parsed from ResponseArray to the elements from this list (ex : )


      assert listsTBname[0].columnName = ResponseArray[0].responseElement


      I assume this would give you an idea, you would still need to work out the other details, such as finding connection string details and adding for loops, in case if there is a need to iterate more elements in responseArray. Hope this helps! 



  • Hello Pramod,


    I am new to SOAPUI Pro and we are planing to build the Frame work and i have gone through your apporch and it was awesome. It would be great if you share the base of this frame work to my


    Thanks in Advance.


    • PramodYadav's avatar

      Hello Prasad, 


      I would not be able to share my project framework since it contains client information, however in future I do intend to create some code snippets to share the general keywords for others use. For now, what I can do is, help you with any specific problems you are facing at this moment. I can share code snippets or suggestions that you may be able to customise for your project. 

      Do let me know if that helps?


      Regards, Pramod

    • PramodYadav's avatar

      Hello Prasad,


      I didnt hear from you. Nonetheless I am working on putting all my knowledge and experience into a general purpose book on how to build frameworks in SoapUI. Hopefully in few weeks or months, I could share more with you. In between, if you have any generic question, do not hesitate to ask.

      Cheers, Pramod 

  • selva29's avatar
    Occasional Contributor

    Hi Pramod, Can you please let me know/ provide code sample for teh below

    1. how to read the values from the External files from remote system ?

    2. How to capture the failed test case logs , failed rest API request reponse and capture that in the external file?