top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the use of variables in Robotframework setup?

+2 votes
500 views
What is the use of variables in Robotframework setup?
posted Feb 27, 2014 by Bhani Bhosle

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Use of variables is recommended in the following cases:

  1. When strings change often in the test data. With variables you only need to make these changes in one place.
  2. When creating system-independent and operating-system-independent test data. Using variables instead of hard-coded strings eases that considerably (for example, ${RESOURCES} instead of c:\resources, or ${HOST} instead of 10.0.0.1:8080). Because variables can be set from the command line when tests are started, changing system-specific variables is easy (for example, --variable HOST:10.0.0.2:1234 --variable RESOURCES:/opt/resources). This also facilitates localization testing, which often involves running the same tests with different strings.
  3. When there is a need to have objects other than strings as arguments for keywords.
  4. When different keywords, even in different test libraries, need to communicate. You can assign a return value from one keyword to a variable and give that as an argument to another.
  5. When values in the test data are long or otherwise complicated. For example, ${URL} is shorter than http://tech.queryhome.com/
answer Feb 27, 2014 by Hiteshwar Thakur
Similar Questions
+2 votes

If possible explain me with an simple example for better understanding.

+4 votes

I am trying to execute a test case using robotframework automation and with every test case i am getting 3 log files which are in html format. I am trying to save those 3 files in a different folder and different path.

Plus if i execute another test case the log files will save there with the increment of their count. like output2.html and so on.

...