Forum Discussion

gpeeters's avatar
gpeeters
Occasional Contributor
12 years ago

not able to remove properties in environment context

Hi,

I'm currently using SoapUI Pro 5.0

I have 3 environments : dev, tst and stg
In a Groovy script I wrote some parameters to project level.

testRunner.testCase.testSuite.project.setPropertyValue("userToken", userToken)
testRunner.testCase.testSuite.project.setPropertyValue("userId", userId)
testRunner.testCase.testSuite.project.setPropertyValue("advertiserId", advertiserId)


Those properties were not defined at project level upfront

the moment I ran the script dev was selected as environment
The properties were created, but only under the dev environment context
They were not existing on general project level, the only place were you can delete them.
So I ended up with parameters under the dev environment that I cannot delete.

Next I created the properties at generic project level.
When I switch to the dev environment settings, I saw my parameters twice.

When I run the script again, the values are written in the project level parameters.

testRunner.testCase.testSuite.project.setPropertyValue should

create the parameters on global project level and fill in the values in the current context
or
An error should be thrown that the parameters are not existant and should be defined first manually.

Kind regards,

Geert

5 Replies

  • Hi,

    What environment was active when you ran the Groovy script? The dev environment may have been active when you ran the Groovy script so the properties were created for the dev environment. You should switch to the environment you want the properties to be created for first.


    testRunner.testCase.testSuite.project.setActiveEnvironment("Default") //switch to default environment
    testRunner.testCase.testSuite.project.setPropertyValue("userToken", userToken)
    testRunner.testCase.testSuite.project.setPropertyValue("userId", userId)
    testRunner.testCase.testSuite.project.setPropertyValue("advertiserId", advertiserId)


    If you switch to default environment, create the properties, and the properties are being created for the other environments also then it's a bug and I will open an internal defect.


    Regards,
    Marcus
    SmartBear Support
  • gpeeters's avatar
    gpeeters
    Occasional Contributor
    that is indeed the case.

    Dev was active at the moment the script ran.
    I'm not able to delete these parameters since that is only possible for the default project properties.
    when I defined the default properties, they were created for all environments, but also again on dev. Now I have duplicates which are not removable
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    I also faced similar problem.

    The project level property added through the script should be shown in the "Custom properties" section and it should be replicated in all the environments. No matter which environment is active.

    The moment we add any custom property manually within the tool, it is replicated in all the environments.

    I had also given feature request in some other post to provide option for user to Add/Delete/Shuffle (up and down) custom properties in the Environments section, the way we can do in the Project Properties / Custom Properties section (basically providing same menu that are available at the Project Properties section)

    Thanks.
  • Hi,

    The moment we add any custom property manually within the tool, it is replicated in all the environments.


    True, but if you switch to the default environment testRunner.testCase.testSuite.project.setActiveEnvironment("Default") the properties are created across all environments. Also, the property values can be different across environments. You can create properties in the the tool with different property values for different environments depending on which environment is active.



    Regards,
    Marcus
    SmartBear Support
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    This was something new to learn that, to get property added across all the environments, active environment should be "Default". Thanks.