View on GitHub

RED - Robot Editor

Eclipse based editor for RobotFramework testcases

RED - Robot Editor User Guide > User guide > Project configuration >

Global variable files

Robot Framework allows to use Python variable files in test suites in two distinctive ways. Direct usage is done by importing the file in Settings section of a suite file as follows:

    
    *** Settings ***
    Variables    <path_to_python_var_file.py>
    

which allows to make the variables from given file accessible across tests suite.

Global usage is a way to use common variable file across any tests suite. In RED this can be achieved by including variables files in red.xml file under Variable Files tab. Once this is done RED will recognize those variables in any suite which would use them. From Robot perspective this is equivalent to providing the file with -V switch in command line.

Python variable files to deal with missing variables

In some test environments Robot-specific environments variables are used in test cases or injected as arguments to Robot test runner. RED is not aware of such usage thus those variables will be marked as unknown and error marker will be placed. In order to include variable name validation without changing test suites, user can create local Python file with list of variable names inside. Such file can be included in red.xml file under Variable files section thus making RED aware of previously unknown variables. Variables from such file will be visible as Global variables for all Robot files inside Project.

Note
Variables provided via red.xml are used by RED only for validation purpose and are not added to Robot run command line when executing tests. During test execution variables have to be provided differently.

Below is a sample body of such Python variable file (examples can be also found in RobotFramework official manual and Python examples).

	
	#!python

	#Sample variables and values
	Scalar = 'value'
	UserList = ['value1','value2']
	UserDict = {'key1': 'value1', 'key2': 'value2'}
	
    

Reloading variable file content

Once the variables file imported into red.xml is changed RED will automatically invoke refresh of variable files being changed so that the modifications are immediately visible. Alternatively this can be done manually by opening context menu on project and selecting Robot Framework -> Reset Robot Environment