Robot Framework Testing Environment
Enterprise test automation with Robot Framework, Browser Library (Playwright), SeleniumLibrary, RequestsLibrary, data-driven testing, parallel execution, and Allure reporting.
What's Inside
| Tool | Version | Purpose |
|---|---|---|
| Python | 3.x | Runtime for Robot Framework |
| Node.js | 20 LTS | Required by Browser Library (Playwright) |
| Robot Framework | 7.x | Keyword-driven test automation framework |
| Browser Library | Latest | Playwright-based web testing (Chromium, Firefox, WebKit) |
| SeleniumLibrary | Latest | Selenium WebDriver web testing |
| RequestsLibrary | Latest | REST API testing |
| RESTinstance | Latest | OpenAPI-based REST testing |
| DataDriver | Latest | Data-driven testing (CSV, Excel) |
| Pabot | Latest | Parallel test execution |
| ExcelLibrary | Latest | Excel file handling for test data |
| DatabaseLibrary | Latest | Database testing |
| SSHLibrary | Latest | SSH/SFTP operations |
| FakerLibrary | Latest | Generate realistic test data |
| RPA Framework | Latest | Robotic process automation keywords |
| Allure | Latest | Advanced test reporting |
| Chromium | Pre-installed | Browser for SeleniumLibrary |
| noVNC | Latest | Watch tests run in a real browser via GUI |
Quick Start
# Run all tests
rf-run
# Run a specific test file
rf-run tests/web_tests.robot
# Run tests by tag
rf-tag smoke
# Run tests in parallel
rf-parallel
# Run + view HTML report
rf-report
# Run API tests
rf-run tests/api_tests.robot
# Show all commands
rf-help
Helper Commands
Test Execution
| Command | What it does |
|---|---|
rf-run [file] |
Run tests (all or specific file) |
rf-tag <tag> |
Run tests by tag (smoke, regression, api) |
rf-parallel |
Run tests in parallel with Pabot (4 processes) |
rf-dry |
Dry run — validate syntax without executing |
Reports
| Command | What it does |
|---|---|
rf-report |
Run tests + serve HTML report on port 9323 |
Tools & Scaffolding
| Command | What it does |
|---|---|
rf-lint |
Lint robot files with Robocop |
rf-init <name> |
Scaffold a new Robot Framework project |
rf-help |
Show all available commands |
Project Structure
workspace/
├── tests/ # Test suites (.robot files)
│ ├── web_tests.robot # Browser Library web tests
│ ├── api_tests.robot # RequestsLibrary API tests
│ ├── browser_tests.robot # Additional Browser Library examples
│ └── data_driven_tests.robot # DataDriver parameterized tests
├── resources/ # Keywords, variables, page objects
│ └── common.resource # Shared keywords and variables
├── libraries/ # Custom Python libraries
│ └── CustomLibrary.py # Example custom keywords
├── data/ # Test data files
│ └── users.csv # Sample CSV for data-driven tests
├── results/ # Test output (log.html, report.html)
├── exercises/ # Guided lab exercises
└── README.md
Browser Library (Web Testing)
Browser Library uses Playwright under the hood — fast, reliable, and supports modern web apps:
*** Settings ***
Library Browser
*** Test Cases ***
Login Flow
New Browser chromium headless=true
New Page https://the-internet.herokuapp.com/login
Fill Text id=username tomsmith
Fill Text id=password SuperSecretPassword!
Click button[type="submit"]
Get Text id=flash *= You logged into a secure area!
Take Screenshot
Close Browser
Key Browser Library Keywords
| Keyword | Purpose |
|---|---|
New Browser |
Launch browser (chromium, firefox, webkit) |
New Page |
Navigate to URL |
Click |
Click element by selector |
Fill Text |
Type into input field |
Get Text |
Assert text content |
Get Title |
Assert page title |
Take Screenshot |
Capture screenshot |
Wait For Elements State |
Wait for element visibility |
API Testing (RequestsLibrary)
Test REST APIs without a browser:
*** Settings ***
Library RequestsLibrary
Library Collections
*** Variables ***
${API_URL} https://jsonplaceholder.typicode.com
*** Test Cases ***
GET Posts Returns 200
[Tags] smoke api
${response}= GET ${API_URL}/posts
Status Should Be 200 ${response}
${posts}= Set Variable ${response.json()}
Length Should Be Greater Than ${posts} 0
POST Creates A New Post
[Tags] regression api
${body}= Create Dictionary title=Test Post body=Test Body userId=1
${response}= POST ${API_URL}/posts json=${body}
Status Should Be 201 ${response}
Data-Driven Testing (DataDriver)
Run the same test with multiple data sets from a CSV file:
*** Settings ***
Library DataDriver file=../data/users.csv dialect=unix
Library RequestsLibrary
Test Template Verify User Exists
*** Test Cases ***
User ${id} - ${name}
[Tags] data-driven
*** Keywords ***
Verify User Exists
[Arguments] ${id} ${name} ${email}
${response}= GET https://jsonplaceholder.typicode.com/users/${id}
Status Should Be 200 ${response}
CSV file (data/users.csv):
id,name,email
1,Leanne Graham,Sincere@april.biz
2,Ervin Howell,Shanna@melissa.tv
3,Clementine Bauch,Nathan@yesenia.net
One test case is generated per CSV row.
Parallel Execution (Pabot)
Speed up test runs with parallel execution:
rf-parallel
# Runs tests across 4 parallel processes
Pabot automatically distributes test suites across processes and merges results into a single report.
Page Object Pattern
Use Robot Framework resource files as page objects:
*** Settings ***
Library Browser
*** Keywords ***
Open Login Page
New Page https://the-internet.herokuapp.com/login
Login With Credentials
[Arguments] ${username} ${password}
Fill Text id=username ${username}
Fill Text id=password ${password}
Click button[type="submit"]
Verify Login Success
Get Text id=flash *= You logged into a secure area!
Then use in tests:
*** Settings ***
Resource ../resources/login.resource
*** Test Cases ***
Valid Login
[Tags] smoke
Open Login Page
Login With Credentials tomsmith SuperSecretPassword!
Verify Login Success
Tagging Convention
[Tags] smoke # Quick validation tests
[Tags] regression # Full regression suite
[Tags] api # API-only tests
[Tags] web # Browser-based tests
[Tags] data-driven # Parameterized tests
Run by tag:
rf-tag smoke # Run @smoke tests
rf-tag api # Run API tests only
rf-tag "smokeANDweb" # Combine tags
Custom Python Libraries
Extend Robot Framework with custom Python keywords:
# libraries/CustomLibrary.py
class CustomLibrary:
def generate_test_email(self, prefix="test"):
import time
return f"{prefix}_{int(time.time())}@learncen.test"
def calculate_percentage(self, value, total):
return f"{(float(value) / float(total)) * 100:.1f}%"
Use in tests:
*** Settings ***
Library ../libraries/CustomLibrary.py
*** Test Cases ***
Generate Test Data
${email}= Generate Test Email user
Log Generated email: ${email}
Watching Tests Run (noVNC)
To see Browser Library tests execute in a real browser:
- Set
headless=falsein your test or run withrf-headed - Open the noVNC URL (port 10000) — append
/vnc.html?autoconnect=true - Watch Chromium execute your tests in real-time
noVNC Troubleshooting
| Issue | Solution |
|---|---|
| Failed to connect | Xvfb or x11vnc not running — restart the workspace |
| Address already in use | pkill -9 x11vnc; pkill -9 Xvfb; pkill -9 websockify |
| Black screen | Restart Xvfb: Xvfb :99 -screen 0 1920x1080x24 & |
Reports
Built-in HTML Report
rf-report
# Output: results/report.html, results/log.html
# Served at port 9323
Robot Framework generates two reports:
- report.html — Summary with pass/fail statistics
- log.html — Detailed keyword-by-keyword execution log
Allure Report
robot --listener allure_robotframework --outputdir results tests/
VS Code Extensions (Pre-installed)
| Extension | Purpose |
|---|---|
| Robot Framework LSP | Syntax highlighting, autocomplete, go-to-definition |
| Python | Python language support |
Keyboard shortcuts:
Ctrl+Shift+B— Run tests + report (default build task)Ctrl+Shift+T— Run all tests (default test task)
Exercises
The workspace includes guided lab exercises:
- RF Fundamentals — Write your first test, understand keyword syntax
- Browser Library — Navigate, click, fill forms, assert, screenshot
- API Testing — Test REST APIs with RequestsLibrary
- Data-Driven Testing — Parameterize with DataDriver + CSV
- Page Object Pattern — Resource files as reusable page objects
- Parallel Execution — Speed up with Pabot
Open the exercises/ folder to start.
Tips
- Robot Framework uses keyword-driven syntax — readable by non-developers
- Browser Library is preferred over SeleniumLibrary for new projects (faster, more reliable)
- Use resource files (
.resource) to organize reusable keywords rf-dryvalidates your test structure without running anything — useful before CI- Variables can be overridden from command line:
robot --variable BASE_URL:https://staging.myapp.com Ctrl+Shift+Bruns tests and opens the report
Security
- Root access is restricted. Use
sudo apt install <package>for system packages. - pip, python3, npm are whitelisted for sudo access.
- Python virtual environment is at
/opt/learncen-venv/bin/python3.