This repository provides an example of Robot Framework (RF) test suite for Web Application testing using Selenium Library for RF.
As example web application under test the Conversion Calculator is used.
For running the test suite you will need:
-
Python 3.6 – install with
pip
(will providepip3
binary) -
Chrome Driver – place
chromedriver.exe
in the same folder ascalculator.robot
file -
Chrome, Chromium or other Chrome–compliant browser – I used Iron Portable (direct link), you will also need to provide the correct path to the executable in the
config.py
file -
and several additional packages for Python, listed in
requirements.txt
— install required packages with:pip3 install -r requirements.txt
Short description of files and folders found here:
- README.md – this document you are reading right now
- requirements.txt – PIP packages list for ease of installation
- calculator.robot – the test suite in ROBOT format
- config.py – path to
chrome.exe
for ChromeDriver and browser specification - output - folder with screenshots created by test suite run, report and log from the run
- Suite Setup/Teardown
- Variables from external file
- User Keywords
- Using Selenium keywords
- Using Text, CSS, XPath and DOM locators
- JavaScript invocation
- Simple step–by–step tests
- Data–driven testing using data table and test template
- Tags
If everything is installed correctly, running the following from cmd.exe
console should do the magic:
robot -d output calculator.robot
Which sould give the following output:
> robot calculator.robot
==============================================================================
Calculator :: Simple Test Suite for Conversion Calculator
==============================================================================
Check if conversion type switch works | PASS |
------------------------------------------------------------------------------
Convert temperature from Celsius to Kelvin | PASS |
------------------------------------------------------------------------------
Check error on minus | PASS |
------------------------------------------------------------------------------
Check conversion change | PASS |
------------------------------------------------------------------------------
Check all conversion types | PASS |
------------------------------------------------------------------------------
Calculator :: Simple Test Suite for Conversion Calculator | PASS |
5 critical tests, 5 passed, 0 failed
5 tests total, 5 passed, 0 failed
==============================================================================
Output: d:\tmp\20170922-RobotTest\RobotFrameworkSolution\output\output.xml
Log: d:\tmp\20170922-RobotTest\RobotFrameworkSolution\output\log.html
Report: d:\tmp\20170922-RobotTest\RobotFrameworkSolution\output\report.html
You can then review what exactly happened by looking into the log file.
-
if you see RuntimeWarning about
robot.run
, don't worry, it's a known issue -
if you see ChromeDriver whining that
cannot find Chrome binary
, double– and even triple–check the path inconfig.py
file