Get a system environment variable?

Not sure why I cant find the answer to this - today Google was not my friend :slight_smile:
As i’d expect it is a common requirement for a test suite to get data from the execution host environment I’m suspicious I’ve missed something…

How do I get a System environment variable in Katalon? Do I have to do it myself programatically or have I missed something glaringly obvious?

programaticaly like in Java

 System.getenv( 'MY_VAR' )
1 Like

How do I use this in Katalon Recorder? Would someone provide a complete example on how to retrieve System Environment Variables and use them in a Katalon script?

When attempting the code above in Katalon Recorder as a command, we get this error:


#### \[info\] Executing: | System.getenv( 'MY_VAR' ) | | |

#### \[error\] Unknown command: System.getenv( 'MY_VAR' )

We do not want to store anything in a Properties file, but only access the variable from the environment.

This is important because we do not want any user credentials stored in our scripts, or uploaded to github. All of our environments have existing login credentials which we can access f

since my advice was for Katalon studio that uses groovy/java, it will not work in web browser plugin like katalon recorder
also i’m afraid that from browser you don’t have access to system environment variables - that would be quite security risc.
maybe there is way using something like node.js but i’m not sure how to use it from recorder

Christopher Brousseau said:


We do not want to store anything in a Properties file, but only access the variable from the environment.

This is important because we do not want any user credentials stored in our scripts, or uploaded to github. All of our environments have existing login credentials which we can access f

guys, did you think to transfer from recorder to Studio? it will open new possibilities. Even if you dont have expirience in programming, it’s easy to start using ii tin tabular mode and in few days/weeks you will be using script mode more often, then one day you will switch to script for good.
Katalon studio is good at that. Give it a try.

2 Likes