I have several test files in different folders (for different issues) and I want to use a separate folder that will contain all the Custom Libraries I use. All of the sub folders, including the custom libraries, will be in one master folder. How do I import the test library from the separated folder?
Here is the folder hierarchy:
Test Library
-Test Suite1
-test1.txt
-test2.txt
-Test Suite2
-test3.txt
-Custom Libraries
-customlibrary.py
Thank you.
There are many ways. For one, just use the path. For example:
*** Settings ***
| Library | ../Custom Libraries/customlibrary.py
Or, you can add Test Library/Custom Libraries
to your PYTHONPATH variable and just use the library name itself:
*** Settings ***
| Library | customlibrary
Or, you can set a variable that defines the directory -- either in a variables table or from the command line:
*** Variables ***
| ${LIBRARIES} | Test Library/Custom Libraries
*** Settings ***
| Library | ${LIBRARIES}/customlibrary.py
This is all described in the robot framework user guide, under the section Using Test Libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With