Welcome to the Robot Framework Template Repository! This repository provides a structured starting point for your automated testing projects using Robot Framework and Python.
- Directory Structure
- Sample Test Cases
- Getting Started
- Notes and recommendations
- Customization Options
- A word on Coding Style
- Authors
The repository comes with a pre-configured directory structure to keep your project organized and to stick with reference Robot Framework Guidelines:
├── .github
│ └── workflows
│ └── ci-cd.yml
├── data
│ ├── your_project
│ ├── shared_data
├── libraries
│ ├── robot_framework
│ └── common.resource
│ └── database_library.resource
│ └── requests_library.resource
│ └── web_testing_library.resource
├── resources
│ ├── common
│ ├── common_python
│ ├── your_project
│ └── your_project_keywords.resource
├── tests
│ ├── your_project
│ └── your_test_cases.robot
├── requirements.txt
├── .gitattributes
├── .gitignore
├── README.md
- .github/workflows: GitHub Actions workflows for CI/CD.
- data: Contains items like test data files, and other static data - like Python or Yaml Variable files and are organized in subfolders in the data/ folder.
- libraries: Stores references to libraries that might be used or referenced by various
.resource
files. - resources: Stores resource files such as shared keywords and project specific keywords.
- tests: All test cases start here.
- requirements.txt: Lists all Python dependencies required for the project.
To help you get started, the repository includes example test cases. These examples demonstrate basic usage and can be modified to suit your needs. They serve as a reference for creating your own test cases.
Currently, the sample test cases cover:
- Basic user interface testing using the web testing library powered by Playwright
- This may be found in sections related to:
project_wikipedia
- This may be found in sections related to:
- Basic API testing using the RequestsLibrary for Robot Framework
- This may be found in sections related to:
project_json_placeholder
- This may be found in sections related to:
- Basic Database testing using the DatabaseLibrary for Robot Framework
- This may be found in sections related to:
project_database
- Please note that the database tests are not meant to be functional as including real database details and running real queries are beyond the scope of this template repository at this time.
- This may be found in sections related to:
- Python >=
3.12
- Node.js >=
22
- Robot Framework >=
7.0.1
- Please see
requirements.txt
for all other Python and Robot Framework dependencies
- Install Python >=
3.12
: Python.org -> Downloads - Install Node.js >=
22
: Node.js -> Downloads (required to allow UI automation using Playwright)- If you are running a Python Virtual Environment in Linux, you will need something
like: Node.js virtual environment
pip install nodeenv
npm install -g npm
- If you are running a Python Virtual Environment in Linux, you will need something
like: Node.js virtual environment
- Restore all other Python dependencies within: requirements.txt
pip install -r requirements.txt
- When running Python virtual environment you might need to set your Python language server to the correct
python.exe
, this should match your Python Virtual environment.- For additional information on IntelliJ Python see this link.
- For Visual Studio code, ensure that the following line is added to your
settings.json
file example:"robot.language-server.python": "C:\\python312_virtual_env\\Scripts\\python.exe"
- Run:
rfbrowser init
to initialize your browser dependency libraries.
Using a Python virtual environment (venv) is recommended on Linux. The simplest way to set this up, is to place the virtual environment inside the project directory, following these steps:
-
Navigate to the project directory:
cd /path/to/your/project
-
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
source venv/bin/activate
-
Update pip:
pip install --upgrade pip
-
Install the required dependencies:
pip install -r requirements.txt
-
(Optional - only needed for UI testing) Setup Node.js:
- Install curl:
sudo apt-get install curl
- Follow the steps published by Node.js here.
- Install curl:
-
(Optional - only needed for UI testing) Install dependencies to run browsers:
sudo npx playwright install-deps
-
(Optional) Deactivating the virtual environment: When you are done working on the project, you can deactivate the virtual environment by running:
deactivate
- If you do not yet have any preference in regard to which IDE and Plugin combination to use, I would strongly recommend: IntelliJ IDEA or PyCharm from JetBrains as an IDE and the Hyper RobotFramework Support plugin for Robot Framework development.
- Other utilities worth considering: RoboTidy is a tool for autoformatting Robot Framework code, RoboCop is a tool for static code analysis of Robot Framework language
This template is designed to be flexible and easily extendable. You can:
- Add new test cases, resources, keywords, and variables to fit your specific requirements.
- Modify the GitHub Actions workflow to include additional steps or custom scripts.
- Update the requirements.txt file to include any additional dependencies.
- Regarding Tabs or Spaces: four spaces are the preferred indentation method as set out by Python PEP 8 standards.
If you are used to using TAB, just set TABBING to go four spaces in your IDE.
- Robot Framework User Guide - Space Separated Format
- Official Python style guides regarding Tabs or Spaces.
- Bernard Visagie