Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Unable to read environment variables in extension tool

Options

I have declared some environment variables and trying to read them in the extension tool.
When i am trying to execute throwing the below error.

Error:No Signature of the method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types.

Below is the code i have used.

import com.parasoft.api,*;

public void usingEnv(){

Application.showMessage(${FileName});
}

FileName i have declared in Environments.
Language which i am using is groovy

Comments

  • YeswanthRatakonda
    Options

    I have used scriptingContext.getEnvironmentVariableValue("Name") and it worked.
    Can some one tell me how to set the env variable??

  • jakubiak
    jakubiak Posts: 801 admin
    Options

    The .tst file in the Test Case Explorer view has an Environments node. Add your variable to an environment there.

  • YeswanthRatakonda
    Options

    I have already added that.
    After doing certain validations i want to change the value for that particular environment variable.
    for getting the value i have use "getEnvironmentVariableValue" method.
    Like wise is there any set method which I can use in my script?

  • jakubiak
    jakubiak Posts: 801 admin
    Options

    You cannot change the value of an environment variable from a script. If you want a variable whose value you can change from a script, use a Test Variable which is defined in a test suite in the Variables tab. You use the getValue() and setValue() methods to work with a test variable.