Environment Variable Masking

kram_soatestkram_soatest Posts: 14


I have a requirement to mask variable in external env file and use it in the script. Here is what i did
In Soatest UI in my environment i right-click masked the value and exported the env
It created variable value with mask-true and encrypted value
Eg original value:Token
After export env file masked value
When i run the test from UI using active environment value i am getting correct unmasked value (Token) when i use the variable in parameter
When i ruin the externally created ENV file using soatestcli i am getting the encrypted token instead of unmasked value i am getting (EncryptedToken)
External env file masked value wont unmask automatically while running the test?

Best Answer

  • benken_parasoftbenken_parasoft Posts: 890 ✭✭✭
    edited July 2018 Accepted Answer

    there is format difference between cli and ui env files

    It wasn't clear that you were using the -environmentConfig, which takes a different kind of XML file. In contrast, you can make the tst file reference a .env/.envs file which just works, regardless of how the tst is run. See Exporting, Importing, and Referencing Environments

    A .env/.envs file supports masking. So, I'd consider that you reference a .env/.envs file from your tst directly, instead of passing a -environmentConfig argument to soatestcli.


  • benken_parasoftbenken_parasoft Posts: 890 ✭✭✭

    I'd recommend running against the .envs file from both the UI and the soatestcli. You should see exactly the same behavior. In other words, how variables are read from an envs file should be the same, regardless of whether the tst is from the UI or the CLI. If you are seeing different behavior then I'd recommend raising this issue with Parasoft Support.

  • kram_soatestkram_soatest Posts: 14

    Thanks @benken_parasoft I am unable to import or reference external env file (created for soatestcli run) as it is in UI as there is format difference between cli and ui env files.
    UI env file when i export will not have "tests,test,workspace" xml tag
    However for CLI env file i need to have those tags
    Without "tests,test,workspace" xml tag i can reference external env file into my UI test and can see mask value picked up as expected
    It is better to contact parasoft support. Isnt it?

  • kram_soatestkram_soatest Posts: 14

    I have a workaround for now by referencing UI supported env file in the test and in cli to give environment instead of environmentconfig. I will check with parasoft support on cli supported environment file masking variable support

  • kram_soatestkram_soatest Posts: 14

    Yes @benken_parasoft I was using environment config. However now I started referencing the env file and masking working fine now with cli. Only thing is if I create a new env file I have to add that as reference in UI.with environment config option I may not need to do that. However for my purpose referencing environment is fine. Thank you @benken_parasoft.

Sign In or Register to comment.