Varyagi Viking
Varyagi Viking

Reputation: 35

How to make path variables available in RobotFramework scripts

I have the following script to test with, while running robotframework 3.1 with pycharm on ubuntu 20.04 LTS:

*** Settings ***
Documentation       Test on executing commands over a serial connection
...

Resource            ${RESOURCES}/serial.resource

*** Test Cases ***
Read From Serial Port
    Connect To Serial Port    /dev/ttyUSB1
    Write Command To Serial  foo
    ${read} =  Read Until  Read Completed
    Log To Console  ${read}

Which runs just fine when adding variables file with the ${RESOURCES} when i run the robot test script. However, during development of the test, it does not find the resource path variable and thus any keyword from the resource can't be found until runtime.

I am using the IntelliBot plugin for pycharm that can autocomplete keywords and quick access keyword definitions, but it only works if i give the path to the resource. Not when using a variable to represent the path.

I've tried exporting the path to PYTHONPATH and exporting variable to system variables with export RESOURCES=/path/to/resource, but it does not find it in robot framework while editing.

There is apparently already available variables like ${SUITE_SOURCE}, but i can't seem to find out how they are made available while editing.

My question is: How can i make the PATH variable available while editing?

Upvotes: 2

Views: 1326

Answers (1)

Updesh Kumar
Updesh Kumar

Reputation: 1

You can try the below code -

*** Settings ***
Resource    ../../../library.robot
*** Test Cases ***

And in library.robot, you can provide all Libraries and Resource.

*** Settings ***
Library           SeleniumLibrary
Library           BuiltIn
Library           String
Library           DateTime
Library           OperatingSystem
Library           Screenshot
Library           ExcelLibrary
Library           Collections
Resource          globalVariable.robot

Hopefully this might help.

Upvotes: 0

Related Questions