Forum Discussion

jeffgaer's avatar
jeffgaer
Occasional Contributor
9 years ago

how to create a groovy script

I am looking at the tutorial at https://www.soapui.org/scripting---properties/scripting-and-the-script-library.html. It does not seem to include the first step, creating the groovy script. Is there a previous tutorial to this?

  • Ok, that does sound like a good candidate for adding a Java/Groovy library and then referring to it. Is the code/library in jar file format? If so, have you tried adding it to the bin/ext folder and restarting? Then you should be able to import its classes from scripts etc.

     

    I was having a search on the community, but I couldn't see any good examples of using java/groovy library jar files in the open source version, most of the discussion seem to be about the pro version's script library functionality. Possible a good quick idea for a blog, am starting a site on this kind of stuff.

     

    Thanks about the book, I hope it proves useful, if there's any feedback/problems please let me know so I can hopefully improve :-) 

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    Its a nice and useful tip page, but if you're not completely familiar with SoapUI you need to be mindful of the context of each script example in order to apply it. Often I found the examples just give ideas to get you started.

     

    For each script example there will be one or often more possible places in SoapUI where the script might be directly applicable or useful. For example, mock scripts, Groovy TestStep scripts, response filter scripts, tear-down/start-up scripts, Script Assertions - scripting is a rich topic with many possibilities in SoapUI as you probably know!

     

    As far as I am aware there is no official (wiki) companion page to that tricks and tips page, but that there are loads of other examples in the wiki, blogs, some books and especially this comunity!

     

    Is there something in particular you wanted to achieve?

     

    Regards,

    Rupert

    • jeffgaer's avatar
      jeffgaer
      Occasional Contributor

      actually just found the answer to my question. I had to create a test case and there is a link on the test case editor to create a groovy script.

       

      I am now stymied by the step

       

      "Now let's setup SoapUI to load up your Groovy library. Set File > Preferences > SoapUI tab > Script Library."

       

      There is no soap UI tab on the preferences page in 5.2.1.

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Ok, that sounds like a TestCase start-up or tear-down script that you wanted.

         

        There is no script library functionality in the open source version, its a SoapUI pro/NG feature. However it is still possible to add your own scripts manually to the bin/ext folder under the SoapUI installation directory.

         

        This is only generally necessary when you need to add larger scripts, like a script library - did you have a particular script in mind? Normally you can just paste them in to the relavent place.