Forum Discussion

evenflow58's avatar
evenflow58
New Contributor
8 years ago

Get environment url in groovy script

Is there a way to get the url set for an environment in a groovy script?
  • groovyguy's avatar
    groovyguy
    8 years ago

    To get the URL, you can use the following snippet. It's not pretty, but it works.

     

    def env = testRunner.testCase.testSuite.project.activeEnvironment;
    log.info(env);
    
    def proj = env.getSoapServiceCount().toInteger();
    
    for (int i = 0; i < proj; i++)
    {
    	def soap = env.getSoapServiceAt(i);
    	def config = soap.getEndpoint().config;
    	def endpoint = new XmlSlurper().parseText(config.toString());
    	log.info(endpoint);
    }