0
votes

I want to run tests in Robot Framework with my defined directory structure

I would also like the following kind of directory structure for the robot framework tests:

Root directory
Libraries
     Library.py
Resource Files
      Resource.txt
Tests
      test_1.txt
      test_2.txt

However, I do not know how to write my tests so they can access my library and resource files. For example, how to import Resource\Resource.txt from Tests\test_1.txt.

Is there any possibility to globally set the directory of the Resources File in Pycharm without defining any variable in the test file? What i trying to do it just write only this:

Resource Resource.txt

in the test file

Best Regards

1

1 Answers

1
votes

This structure is quite normal one, and both Robot Framework and Pycharm will work OK with it.

When importing the files in each other, use a relative path to them. As "Libraries", "Resource Files" and "Tests" are sibling directories, that would mean using .. ("go up to my parent directory") and then specifying the location to the target file from there.
For example:

Resource   ../Resource Files/resource.txt
Library        ../Libraries/Library.py