Skip to content

This repository is designed to provide a robust and scalable foundation for your test automation projects using Robot Framework. Whether you're a seasoned automation engineer or just getting started, this template includes all the essentials to kickstart your testing efforts with ease.

License

Notifications You must be signed in to change notification settings

BVisagie/robot-framework-template

Repository files navigation

Robot Framework Template Repository

Welcome to the Robot Framework Template Repository! This repository provides a structured starting point for your automated testing projects using Robot Framework and Python.

Official repository: github.com/BVisagie/robot-framework-template

Table of Contents

Directory Structure

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.

Sample Test Cases

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
  • Basic API testing using the RequestsLibrary for Robot Framework
    • This may be found in sections related to: project_json_placeholder
  • 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.

Getting Started

Dependencies

  • Python >= 3.13
  • Node.js >= 22
  • Robot Framework >= 7.1.1
  • Please see requirements.txt for all other Python and Robot Framework dependencies

Installing for local development

For step-by-step setup on your OS (Python 3.13+, Node 22+, venv, Playwright deps, and Browser init), follow the Quickstart Guides:

Quickstart commands

# Lint and format checks (Robocop v6+)
robocop check .
robocop format .

# Run API tests
robot --outputdir output tests/project_json_placeholder/api_tests

# Run UI tests (headless by default)
robot --outputdir output tests/project_wikipedia/ui_tests

Quickstart Guides

Optional developer tooling:

# Install dev tools (pre-commit, Robocop v6+, Ruff)
pip install -r requirements-dev.txt
pre-commit install

Configure the project to use a Python Virtual Environment

See the platform-specific Quickstart Guides for creating, activating, and using a virtual environment.

Notes and recommendations

  • IDE and plugins
    • Primary recommendation: RobotCode — multi‑IDE language server, debugger, analyzer, REPL, refactoring, profiles via robot.toml.
    • Alternative: Hyper RobotFramework Support.
    • Editors: VS Code or JetBrains IDEs both work well.
    • Tip: enable Robotidy/Robocop integration or use pre‑commit to keep quality consistent.
  • Linting/formatting
    • Robotidy for formatting.
    • Robocop for static analysis.
    • This template includes basic configs and optional pre‑commit hooks.

Customization Options

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.

Environment variables

  • HEADLESS_BROWSER (true/false) to control headless mode (defaults to true).
  • WIKIPEDIA_BASE_URL to override the default Wikipedia base URL.
  • Database-related variables (examples only): DB_HOST, DB_PORT, DB_SERVICE_NAME, DB_USER, DB_PASSWORD, DB_API_MODULE.

A word on Coding Style

RF-native first

  • Prefer native Robot Framework syntax, libraries, and patterns. Use Python only when a clear gap exists.
  • Examples here keep Python to a minimum (e.g., a single helper function) and showcase RF v7+ features.

Database examples (non-functional by default)

  • DB examples are placeholders, tagged to avoid accidental execution.
  • You can optionally provide DB settings through environment variables and build a &{db} dictionary using the provided keyword.
  • See the keywords in resources/project_database/db_actions_and_verifications.resource for details.

Authors

  • Bernard Visagie

About

This repository is designed to provide a robust and scalable foundation for your test automation projects using Robot Framework. Whether you're a seasoned automation engineer or just getting started, this template includes all the essentials to kickstart your testing efforts with ease.

Topics

Resources

License

Stars

Watchers

Forks