Accessing environment from Groovy script test step
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2021
07:17 AM
09-10-2021
07:17 AM
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2021
09:44 AM
09-10-2021
09:44 AM
would you please show what you have tried? and the available environments?
Regards,
Rao.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2021
11:40 AM
09-10-2021
11:40 AM
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:
My environment setup is:
