2
votes

Basically, I want to do some web testing through Robot Framework. However, I would like to have the user change the variables without needing to edit the .robot file.

Here is part of what I will be using:

`*** Settings ***
Library    Selenium2Library`

`*** Variables ***
${HOMEPAGE}    http://"website-name"/
${BROWSER}     Chrome
${USERNAME}    *****
${PASSWORD}    *****
${DELAY}       10
${LOGIN}       link=LOGIN`

I would like for the user to be able to change certain variables such as ${USERNAME} or ${PASSWORD} through a front end landing page that I've set up. I will get these data in PHP via a form that they will enter.

The only problem is, I still have no idea how to inject these variables into my .robot file.

1

1 Answers

2
votes

You can edit the variables via the command line. So what I suspect you could do is create the command line command to fire off your test via the PHP input, and then just fire it off.

PHP input > Command containing variable edit > fires off test with desired variables

You can do this via the --variable option on the command line for firing off your tests. In your case it would look something like this:

robot --variable USERNAME:Username test.robot

how it would look like in PHP, is down to you... But the --variable VARIABLE_NAME:value would be the direction for you to take.

read more about it here.

You essentially want to capture the input from the user via PHP. Inject that input into the --variable option on the command line, and get PHP to fire off the python / robot for you. That's what I would do.

Any questions please ask.