Forum Discussion

saurabhsharma09's avatar
saurabhsharma09
Contributor
12 years ago

Change soap UI Environment value through Groovy

Hello,

I came to know about soap ui Environments feature and It's easy to change environments from SOAP UI Interface and run test suites.
I have Soap UI tests running successfully in Jenkins for a specific environment and I am passing Service Endpoint through String parameter present in Jenkins Job.
Now I don't want to have multiple Jenkins jobs for soap ui tests to run on different environments(QA,Staging,Production..) and want to pass this
environment value also from Jenkins.
Is there any way to programmatically set that environment value before running any tests so that the same Jenkins job can be reused for different environments?
I am new to groovy so any help in this regard is appreciated.

Thanks,
Saurabh
  • Hello Marcus,

    Yes I saw that earlier but it is using test runner to set environment and i don't know the corresponding groovy which i can use in Load Script section at project level as I want to set environment at project load and not in test case.
    If you can point me to the same it would be very helpful.

    Regards,
    Saurabh
  • Hi,

    The same code snippet applies, except you do not have to use testrunner to get to the project.



    project.setActiveEnvironment("Test")




    Regards,
    Marcus
    SmartBear Support