Reputation: 81
I want to use the environnement variables provided by jenkins (like Build_Id
) as part of my robot script.
For eg:
user = "abc" + Build_Id
This is so that I can match my variable/value to a particular build.
Is there a way to use the env variables inside a Robot script?
Upvotes: 1
Views: 9585
Reputation: 4820
Yes you can pass command line options as described here.
So, if you start RF via Jenkins shell execution do something like this:
robot --variable Build_Id:$Build_Id path/to/tests/
If you start RF indirectly by calling a script or maven or ant build script, you have to pass the variables accordingly (here is an example for maven).
Upvotes: 2
Reputation: 20067
You can easily access environment variables, in fact they are available in the cases/keywords scope just like a normal user-defined variable
${my var}= Set Variable abc %{BUILD_ID}
Note the access char is %
, not $
as is for the user variables.
You can also use the keyword Get Environment Variable from the OperatingSystem library, which allows to have a default value if the env variable is not present, or fail the case/keyword.
Upvotes: 3