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.

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.12
  • Node.js >= 22
  • Robot Framework >= 7.0.1
  • Please see requirements.txt for all other Python and Robot Framework dependencies

Installing for local development

  1. Install Python >= 3.12: Python.org -> Downloads
  2. Install Node.js >= 22: Node.js -> Downloads (required to allow UI automation using Playwright)
    1. If you are running a Python Virtual Environment in Linux, you will need something like: Node.js virtual environment
      1. pip install nodeenv
      2. npm install -g npm
  3. Restore all other Python dependencies within: requirements.txt
    1. pip install -r requirements.txt
  4. 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.
    1. For additional information on IntelliJ Python see this link.
    2. For Visual Studio code, ensure that the following line is added to your settings.json file example:
      1. "robot.language-server.python": "C:\\python312_virtual_env\\Scripts\\python.exe"
  5. Run: rfbrowser init to initialize your browser dependency libraries.

Configure the project to use a Python Virtual Environment

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:

  1. Navigate to the project directory:

    cd /path/to/your/project
  2. Create a virtual environment:

    python3 -m venv venv
  3. Activate the virtual environment:

    source venv/bin/activate
  4. Update pip:

    pip install --upgrade pip
  5. Install the required dependencies:

    pip install -r requirements.txt
  6. (Optional - only needed for UI testing) Setup Node.js:

    • Install curl: sudo apt-get install curl
    • Follow the steps published by Node.js here.
  7. (Optional - only needed for UI testing) Install dependencies to run browsers:

    sudo npx playwright install-deps
  8. (Optional) Deactivating the virtual environment: When you are done working on the project, you can deactivate the virtual environment by running:

    deactivate

Notes and recommendations

  • 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

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.

A word on Coding Style

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