Forum Discussion

krogold's avatar
krogold
Regular Contributor
2 years ago
Solved

get swagger ident from groovy script

Hi, In my project, I import a swagger (.yaml) file to do definition update. I would like to know if it is possible to get its identification from a groovy step ? ie. in my resources / Specification...
  • krogold's avatar
    2 years ago

    Well, finally I found it : when you get your interface's data (your APIs)

     

    restServiceList = testRunner.testCase.testSuite.project.getInterfaceList()

     

     

    and you select the one you want (I have two of them), then you can identify the context and get the url

     

    restServiceList.each{
        interface ->
        if (interface.getName() == "myInterfaceName")
        {
           myContext = interface .getDefinitionContext()
           log.info myContext.url // ==> gives you the swagger's path
        }
    }