Forum Discussion

Ludo15101966's avatar
Ludo15101966
Contributor
7 years ago

REST Resource and method

Hello,

I'm trying to get the full list of the REST web services used by my project

With Groovy I'm listing the suites ,cases and steps but I need some infos displayed by ready api:

 

Resource and Method for a ws request

 

Could you help me to get theses properties ?

 

Thank you

 

  • Lucian's avatar
    Lucian
    Community Hero

    Hey,

     

    How about this?

     

    // Get all interfaces in the project
    def interfaces = testRunner.getTestCase().getTestSuite().getProject().getInterfaceList()
    def restInterfacesCount = 0
    
    interfaces.each() {
    	if (it instanceof com.eviware.soapui.impl.rest.RestService) {
    		log.info "----------------"
    		log.info it.getName()
    		it.getOperationList().each() {
    			log.info "        " + it.getName()
    		}
    	}
    }
    • Ludo15101966's avatar
      Ludo15101966
      Contributor

      Hello Lucian,

       

      Thank you for your answer,

       

      This code seems to give the full resources of the web service definitions, not related to a particular step

      What I need is to list the resource and method really used by each of my project steps (kind of coverage)

       

      The property should be found at teststep level ?

       

      I've tried code like that

       

                  def testcasetype     = teststep.config.type;
                  def testcasews     = teststep.getProperty("Resource")
                  def testcasemet     = teststep.getProperty("Method")

       

      but gives me nothing usable

       

      Thank you

      Regards

       

      • Lucian's avatar
        Lucian
        Community Hero

        Ahhh I see. I will try to see if I can do something later today. I can't promise anything though.