2
votes

I am working in robot framework. I have two variables files in it. I want to pass these variables files dynamically. In certain condition I want to send a.py and in others b.py. But this information I want to pass dynamically. Can you please help me with this

1
When you say "pass these variable files dynamically", what do you mean? Pass them from where? Pass them to where? Do you mean that you want to pass them into a keyword? Or, are you saying you want to pass them from the command line to a test suite? - Bryan Oakley

1 Answers

5
votes

You can use the Import library keyword to manually import an external file.

Then use the Run Keyword If keyword to check which library to import. For example:

Run Keyword If   '${VAR}' == 'a'   Import Library   a.py
Run Keyword If   '${VAR}' == 'b'   Import Library   b.py

You can pass the VAR as a parameter to your test:

pybot --variable VAR:a TestSuite