Ask a Question

Accessing environment from Groovy script test step

sjakovac
Occasional Contributor

Accessing environment from Groovy script test step

I want to get hold of the environment inside groovy script in Groovy test step. This solution does not work in ReadyAPI 3.9.1.

If there is another way of getting projects APIs and their endpoints in the current environment, that would help also. (KafkaEndpoint to be precise)

2 REPLIES 2
nmrao
Community Hero

would you please show what you have tried? and the available environments?


Regards,
Rao.
sjakovac
Occasional Contributor

I can get an active environment using 

def env = context.testCase.testSuite.project.getActiveEnvironment()

But I can not access Kafka service /endpoint like it's suggested for REST/SOAP service.

For example, after the previous line none of the following works:

def kafkaService = env.getService('Name of kafka service', com.eviware.soapui.config.ServiceConfig.Type.Enum.forString("KAFKA"))
def kafkaService = env.getKafkaServiceAt(0)

Autocomplete/code-suggestion is not of any help so I don't know what else is available through env object. When I run following to try to discover something:

env.getProperties().each { name, val ->
	log.info(name + ': ' + val)
}

Output is:

sjakovac_0-1631299065639.png

 

My environment setup is:

sjakovac_2-1631299223700.jpeg

 

cancel
Showing results for 
Search instead for 
Did you mean: