Forum Discussion

Glenn_Halstead's avatar
Glenn_Halstead
Occasional Contributor
16 years ago

set enviroment variable... whats the syntax?

Whats the syntax to set an environment variable from a groovy teststep?

I use the follwoing to set a project variable:

def project = testRunner.testCase.testSuite.project
project.setPropertyValue("mqResponse", "blah")
  • Hello,



    def env = System.getenv() // to get system enviroment
    log.info env["USER"] // get enviroment property named user

    def prp = System.getProperties() // get system properties
    log.info prp["soapui.home"] //get system property soapui.home

    System.setProperty("prp name", "value") //set property value



    Hope this helps,

    robert
  • Glenn_Halstead's avatar
    Glenn_Halstead
    Occasional Contributor
    Thanks for your reply Robert.  I do have my solution working using a properties file.  I'll try the environment variable solution and use the one that seems best... I don't think there's much between them really.