Reputation: 2745
I am calling keyword for suite setup as below
Suite setup setup keyword
But can I call python file from suite setup or keywords file?
I have lot of keywords as setup so is there any way I can pass them all together?
I can use run keywords
to pass multiple keywords but can I pass file?
Upvotes: 1
Views: 1522
Reputation: 385850
You can't give a filename as an argument to a suite setup, but you can certainly create a file that has a single keyword that does everything you want.
You could also use a variable file, which will get executed before any tests will run.
To use a library file, put all the code you want to execute in a single function. For example:
# my_setup_file.py
def my_setup():
do_something()
do_something_else()
You could then use it like this:
# my_suite.robot
*** Settings ***
| Library | my_setup_file.py
| Suite setup | my_setup
You can use a variable file, which in effect works like loading up a file in setup since the file is evaluated before the start of the first step (and before any other setup steps)
In this case your python file would not need a function, it could have any code. All variables defined in this file will be available to your test case.
# my_variables.py
foo = "this is foo"
bar = "this is bar"
You would then use it like this:
*** Settings ***
| Variables | my_variables.py
Upvotes: 1