Search code examples
robotframework

How to set an environment variable in Robot Framework


Trying to set an env var using robot script

${res}=  Set Environment Variable  ABCDE  12345

But when I check the env vars from my shell, I am not able to find it!

grep-ing the env var key in shell

Robot Logs:

Robot logs


Solution

  • Environment variables are local to the process in which they are created. They are inherited to child processes, but not to parents. That's why you can't see them in the calling process. *ix shells have a special export command to export environment variables, but there is no export feature in Robot Framework. So, AFAIK this is not possible.