tuexss
tuexss

Reputation: 221

How do I check if an environment variable exists in Robot?

Variable Should Exist does not work with environment variables, when I try it throws this error Invalid variable syntax '%{ENV_VAR}'.

Is there a way to check without assigning the value of the env_var to a local var and use the keyword above on that?

Upvotes: 1

Views: 6253

Answers (2)

Bryan Oakley
Bryan Oakley

Reputation: 386010

The OperatingSystem library has a keyword named Environment Variable Should Be Set which can be used for this purpose.

Upvotes: 4

JaPyR
JaPyR

Reputation: 1569

you could use combination of Run Keyword And Return Status and Get Environment Variable:

${status}    Run Keyword And Return Status    Get Environment Variable    BUILD_NUMBER

Upvotes: 3

Related Questions