Forum Discussion

evenflow58's avatar
evenflow58
New Contributor
7 years ago
Solved

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
    7 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);
    }