Passing variables between 2 robot files

I have 2 .robot files and I want to get variable from another robot file’s for loop. I shouldn’t share my companies codes so this is example code.

Help1.robot
*** Settings ***
Library | Selenium2Library
Resource | variable.robot

*** Variables ***
${tester} | 1

*** Keywords ***
Example
FOR | ${i} | IN RANGE | 5
${tester} | Evaluate | ${tester} + 1
Set Global Variable | ${tester}
Log To Console | ${exampleVar}
END

Test Cases
TestCase
Example

Help2.robot
*** Settings ***
Variables | test.robot

*** Variables ***
${exampleVar} | ${tester}

If the Help2.robot does not contain the *** Test Cases *** section, then you can use it as a Resource file in Help1.robot.

Thank you so much. Acutually I want to get ${exampleVar} from Help2.robot file but ${exampleVar} variable is equals to ${tester} variable and ${tester} variable takes value form FOR loop. This is a bit complicated but I have to solve that. Because I define xpaths into the variables and some xpaths get value by FOR loop. Can I do it, is it possible?

You will work better if using Python variables files.
You can even define a function that can take your arguments to use in a for .

Hi Berk,

TestDataTable is a tool designed for use in performance testing, but can be used for anything, it sounds like it might be useful for you.

In performance testing it’s common to pass values from one test to another even when those tests are running on different machines.

Here’s an example, possibly more complicated than your scenario but this is the type of thing TestDataTable is designed to help with.

Start of end to end scenario

Test case 1 - Customer places order

  • Selenium Library
  • creates an order with items in shopping cart using internet exposed website
  • gets order number - send to “new order” column in TestDataTable

Test case 2 - Finance department

  • SapGui Library
  • gets order number from “new order” column in TestDataTable
  • Updates status of order in SAP GUI to payment received
  • Sends order number to “process order” column in TestDataTable

Test case 3 - Warehouse operator

  • Appium Library
  • gets order number from “process order” column in TestDataTable
  • updates Android mobile application as items are collected from the Warehouse shelves
  • updates Android mobile application when items are delivered to dispatch area
  • Sends order number to “dispatch order” column in TestDataTable

Test case 4 - dispatch officer 1

  • Selenium Library
  • gets order number from “dispatch order” column in TestDataTable
  • simulates dispatch officer packing items into box, placing shipping label and notifying the courier company to pick up the order.
  • updates internal web application with shipment tracking number and marks order as ready for shipping
  • Sends order number to “ship order” column in TestDataTable

Test case 5 - dispatch officer 2

  • Selenium Library
  • gets order number from “ship order” column in TestDataTable
  • simulates dispatch officer handing order to the courier
  • updates internal web application marks order as shipped
  • Sends order number to “order shipped” column in TestDataTable

End of end to end scenario