Forum Discussion

OOTesting's avatar
OOTesting
Occasional Contributor
6 years ago

Call a groovy assertion script form an external file

I'm new to readyAPI and would like to know if it is possible to call a groovy script as a external file that can then be used by all test cases?

 

My soap based response include a success response code that is in all responses, I want to verify that response code is included in every response.

 

Rather than adding the script to every request, can we specify a single external file to be called instead?

3 Replies

  • JHunt's avatar
    JHunt
    Community Hero
    Since you mentioned ReadyAPI, I have moved this to the SoapUI Pro forum. ReadyAPI might have some nifty tricks to help with what you're doing here (but I've never used it). If I've made a mistake and you're using SoapUI Open Source, let me know and I'll move it back and offer some suggestions.
    • OOTesting's avatar
      OOTesting
      Occasional Contributor

      Hi,

      Although using readyAPI, I prefer to have a solution that can be utilised for SOAPUI (open source) as well.

  • Radford's avatar
    Radford
    Super Contributor

    You can specify a directory to store common groovy scripts, see the documentatiuon here for details of how to specify the directory and how to structure your Groovy files:

     

    https://support.smartbear.com/readyapi/docs/testing/scripts/library.html

     

    Note: The above documantation shows you how to set a global scripts directory, should you wish to specify a "per project" scripts directory, see documantation here:

     

    https://support.smartbear.com/readyapi/docs/projects/ui/projects/properties.html