Robot Framework Tutorial: Write and Run Your First Test Suite
Robot Framework tutorial covering installation, .robot file sections, keywords, variables, tags and reading log.html and report.html after your first run.
Read article
Robot Framework installation follows the same basic process on Windows, macOS and Linux: install Python, create a virtual environment, install the package with pip and verify the result. The differences between operating systems are mostly about activating environments and making sure the right commands are on your PATH.
Robot Framework is a Python package, so everything starts with a supported Python 3 interpreter. Each framework release lists its supported Python versions in the installation notes, which are worth checking when you use an older or very new Python release.
python --version
python -m pip --version
On some Linux and macOS systems the command is python3 instead of python. On Windows, the py launcher is often available and selects an installed version automatically.
| System | Common Python command | Typical source of Python |
|---|---|---|
| Windows | python or py | Installer from python.org or Microsoft Store |
| macOS | python3 | Installer from python.org or a package manager |
| Linux | python3 | Distribution packages |
Download Python from python.org and enable the option that adds Python to PATH during installation. Open a new PowerShell or Command Prompt window afterwards so the updated PATH is picked up, then create and activate a virtual environment in your project folder.
py -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install robotframework
If PowerShell blocks the activation script, the execution policy for your user may need adjusting according to your organisation’s rules. Command Prompt uses .venv\Scripts\activate.bat and is not affected by that policy.
macOS users usually install Python from python.org or with a package manager such as Homebrew. Using a virtual environment is strongly recommended, because it avoids conflicts with system tools and with packages installed for other projects.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install robotframework
After activation, python and pip point to the environment, so the shorter commands work until you run deactivate or close the terminal.
Most distributions include Python 3, but the venv module is sometimes packaged separately. On Debian and Ubuntu, install the python3-venv package if creating an environment fails, then follow the same activation steps used on macOS.
sudo apt install python3-venv # Debian / Ubuntu, if needed
python3 -m venv .venv
source .venv/bin/activate
python -m pip install robotframework
Avoid installing packages into the system Python with sudo pip. Recent distributions actively block that approach to protect system tools, and virtual environments are the cleaner solution anyway.
Run the version command inside the activated environment. It prints the installed framework version together with the Python interpreter in use, which confirms that both the package and the command-line entry points are working.
robot --version
python -m robot --version
A quick smoke test is even better. Create a file called smoke.robot with a single test that logs a message, run it with robot smoke.robot and open the generated log.html. The Robot Framework tutorial walks through that first suite in detail.
External libraries are installed with pip into the same environment. Recording them in a requirements file keeps every machine consistent, from a developer laptop to the CI server that runs the full regression suite.
robotframework-seleniumlibrary for Selenium-based browser testingrobotframework-browser for Playwright-based browser testingrobotframework-requests for HTTP and API testingrobotframework-pabot for running suites in parallelpython -m pip install robotframework-seleniumlibrary
pip freeze > requirements.txt
Browser library has an extra step that installs Node.js dependencies and browsers. Its own documentation describes that initialisation command, and the Robot Framework Selenium article compares both browser libraries.
Upgrades use pip as well. Read the release notes before moving to a new major version, run your suites after upgrading and watch for deprecation warnings in the log, which point to syntax that will change in later releases.
python -m pip install --upgrade robotframework
python -m pip uninstall robotframework
Most installation problems come from PATH settings or from using a different Python than expected. Checking which interpreter is active usually reveals the cause within a minute.
| Symptom | Likely fix |
|---|---|
| robot command not found | Activate the environment or use python -m robot |
| Package installed but not found | Install with python -m pip so pip matches the interpreter |
| Permission errors | Use a virtual environment instead of the system Python |
| Environment creation fails on Linux | Install the python3-venv package |
| Library import fails | Install the library into the active environment |
Installing from the source archive is also possible for development purposes. The Robot Framework GitHub article explains how the repository is structured and how editable installs work.
Any text editor can open .robot files, but a dedicated extension makes daily work far more comfortable. Extensions for popular editors such as VS Code and PyCharm add syntax highlighting, keyword completion, navigation to keyword definitions and inline error reporting based on the libraries installed in your environment.
.venvSelecting the correct interpreter is the step most often missed. When the editor uses a different Python than the terminal, keywords from freshly installed libraries appear as unknown even though tests run without errors.
CI servers follow exactly the same steps as a workstation: check out the code, create an environment, install requirements and run the robot command. The exit code equals the number of failed tests, capped at 250, so any failure marks the pipeline step as failed automatically.
python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
robot --outputdir results tests/
Archive the results folder as a pipeline artifact. Keeping log.html and report.html from every run makes it simple to investigate failures later without rerunning the suite.
When setting up a project for a team, put the dependency file at the root of the repository and document the command that runs a small verification suite. Rebuild the environment from that file on a second machine before sharing the setup instructions. If the verification passes in both places, the team has a repeatable starting point. If it fails, compare the selected Python interpreter, installed package versions and working directory before changing the tests. Keep the verification suite under version control alongside the dependencies.
Robot Framework installation comes down to a supported Python, a virtual environment and one pip command, on Windows, macOS and Linux alike. Verify the setup with robot --version, record dependencies in a requirements file and add libraries only when your project needs them.