Forum Discussion

BalamuruganRavi's avatar
BalamuruganRavi
Occasional Contributor
9 years ago

How to create REST project using Groovy script?

My requirement:  Get the URI/WADL as input from user, create the new REST project and generates the TestSuite and Test Case for each resource.

1. is that possible to do using groovy scripting/soapUI APIs ?

2.if yes kindly tell me the way how i can achive this?

 

 

10 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

    I would expect that to create a REST project, TestSuite and TestCase from a WADL is certainly possible using Groovy Script, but before going any further, given that you say this is based on a URI/WADL that the user provides, may I ask:

    a) Why you want to do this and why the usr cannot just use the menu driven functionality e.g. new REST project from WADL?

    b) Is it that you want to generate the project on the fly and have many different WADLs to use? If you just want to vary the REST service endpoint / request values of the tests, then there are easier ways to achieve this.

    Cheers,

    Rupert

     

     

    • BalamuruganRavi's avatar
      BalamuruganRavi
      Occasional Contributor

       

      Thanks for the quick response

       

      a) I will have GUI for user to provide the URI / WADL as input. based on that it generates TestSuites,Testcase automatically.

      b) Generate the new  REST Project and override the endpoint/request params.

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Ok, no problem.

         

        for a) I take it you know how to get the GUI to generate a REST project / TestSuite / TestCase based on the WADL/URI? e.g. File New REST Project > Import WSDL (or use URI) etc and generate TestSuite, TestCase and REST Test Request Test Step? Sorry if this is not what you meant.

         

        for b) You would need to parameterise (using property expansions) the enpoint / request params for the REST Test Request TestStep - to do this, have you seen this other questsion & answer that came up today it covers this topic:

         

        http://community.smartbear.com/t5/SoapUI-Open-Source/Can-resource-path-of-a-REST-API-be-changed-by-data-source/m-p/42010#U42010

         

        Once parameterised, you can then provide the values for the endpoint/request from anywhere you like e.g. files, databases, other service responses, property files etc.

         

        Is this the sort of thing you meant?

         

        Cheers,

        Rup