This small tutorial shows, how to run a generic Robot Framework test with Selenium Grid.
Preparation
- Java needs to be installed
- Download latest Selenium Server from Selenium HQ
- Robot Framework is installed
- Selenium2Library is installed
- Firefox is installed
Steps
Now we create a very simple test
*** Settings ***
Documentation This is just a tutorial
...
Metadata VERSION 0.1
Library Selenium2Library
Suite Setup Start Browser
Suite Teardown Close Browser
*** Variables ***
${SERVER} https://www.google.ch
${BROWSER} firefox
*** Keywords ***
Start Browser
[Documentation] Start firefox browser on Selenium Grid
Open Browser ${SERVER} ${BROWSER} None http://127.0.0.1:4444/wd/hub
*** Test Cases ***
Check something
[Documentation] Check the page title
Title Should Be Google
Now start the Selenium Grid (Hub and Node)
# start the hub (in terminal 1)
$ java -jar selenium-server-standalone-2.44.0.jar -role hub -port 4444
# start the node (in terminal 2)
$ java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register
Note: The actual version for selenium-server-standalone may be different!
Open the browser http://localhost:4444/grid/console and check the node is registered. This step can be skipped, just to be sure.
In the last step we start the test. Open a 3rd terminal, browse to the folder and start the Robot Framework.
# run pybot
$ pybot tutorial.robot
If everything works well, the output should look like this:
================================================================
Tutorial :: This is just a tutorial
================================================================
Check something :: Check the page title | PASS |
----------------------------------------------------------------
Tutorial:: This is just a tutorial | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
================================================================
Output: /output.xml
Log: /log.html
Report: /report.html