Skip to content

halloichbinrohit/ParallelTestingInRobotFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Parallel UI Test Automation Framework using Robot Framework and Pabot Library

  • This repository contains a modular and scalable UI automation framework built using Robot Framework, Python, and Selenium library.
  • It supports parallel execution, data-driven testing, and generates detailed reports using Allure and Default Robot Framework Report.

πŸ“‚ Project Structure

β”‚   .pabotsuitenames                                                      # Defines suite names or grouping when using Pabot (parallel execution tool).
β”‚   README.md                                                             # Overview of the project, setup instructions, how to run tests, dependencies, and usage.      
β”‚   requirements.txt                                                      # Lists Python packages needed (e.g., robotframework, pabot, allure-robotframework, etc.).
β”‚   runtest.ps1                                                           # A PowerShell script that orchestrates running the full test suite via Robot Framework and Pabot, possibly including Allure report generation.
β”œβ”€β”€β”€allure-report                                                         # Output directory of the generated Allure HTML report, giving a rich UI view of test execution data.
β”œβ”€β”€β”€allure-results                                                        # Contains raw test result artifacts (JSON, XML, attachments) generated during executionβ€”used for building Allure reports.
β”œβ”€β”€β”€libraries
β”‚   β”‚   logger.py                                                         # A custom Python library module defining logging or reporting keywords for use in Robot scripts. Makes logs more structured and reusable across test suites.
β”œβ”€β”€β”€logs                                                                  # Stores .log files generated for each test scenario, usually plain-text or structured logs
β”‚       Invalid user but valid password_app.log
β”‚       Login with empty user but password_app.log
β”‚       Login with locked out user_app.log
β”‚       Login with user but empty password_app.log
β”‚       Valid user but invalid password_app.log
β”‚       Verify Login Page Heading Displayed With Required Text_app.log
β”‚       Verify Login Page Title For SauceDemo Website_app.log
β”‚       Verify Login Successful For Valid Credentials_app.log
β”œβ”€β”€β”€pages
β”‚       Home_Page.resource                                               # Keywords for homepage validation, navigation flows.
β”‚       Login_Page.resource                                              # Contains reusable keywords representing login screen interactions (enter username, password, click, etc.).
β”œβ”€β”€β”€results
β”‚   β”‚   log.html                                                         # Detailed HTML log report generated by Robot Framework.
β”‚   β”‚   output.xml                                                       # Core Robot Framework execution data file (XML).
β”‚   β”‚   report.html                                                      # Summary HTML report (pass/fail, test suites, tags).
β”‚   └───pabot_results                                                    # Pabot-specific subfolder capturing parallel execution results (separate directory)
β”œβ”€β”€β”€testcases
β”‚       Invalid_Login_Tests.robot                                        # Suite for negative login scenarios (wrong username, locked accounts, missing fields), data driven based
β”‚       Sauce_Home_Tests.robot                                           # Tests for homepage behavior (home page display, title etc)
β”‚       Valid_Login_Tests.robot                                          # Scenarios verifying successful login flows.
β”œβ”€β”€β”€testdata
β”‚   β”‚   Invalid_Login_Tests.csv                                          # Data‑driven values for invalid login scenarios (usernames, passwords, error messages).
β”‚   β”‚   invalid_login_test_data.py                                       # Python-based data provider (perhaps used to parameterize tests programmatically).
└───utils                                                                # Shared support logic used across resources or tests:
        common.resource                                                  # Generic or cross-functional keywords (e.g. setup/teardown, navigation, global utilities).
        helpers.resource                                                 # Additional reusable utility keywords (e.g. element inspection, waits, assertions)
        logging.resource                                                 # Robot-level keyword wrappers for structured logging, potentially interfacing with logger.py.

πŸš€ Features

  • βœ… Pabot/robot based test runner
  • βœ… Parallel testing with robotframework-pabot library
  • βœ… Separate logging for each test
  • βœ… Interactive Allure and Robot Framework HTML reports
  • βœ… Template based driven data tests
  • βœ… Custom utility functions
  • βœ… Supports Custom logging library and Page Object Model

🧰 Tools & Libraries Used

  • pycharm/vscode
  • robotframework
  • robotframework-seleniumlibrary
  • allure-robotframework
  • robotframework-pabot

πŸ“ Logging

  • Each test creates a separate log file under the logs/ directory using a custom logger defined in utils/logging.resource and libraries/logger.py.

πŸ“‚ Sample Test Types

  • πŸ” Basic validations on Homepage (title, heading etc)
  • πŸ“„ Validation of successful login
  • πŸ” Validation of invalid logins and error messages based on data driven approach

πŸ“ˆ Reporting

  • βœ… Allure : Provides interactive test results, Captures logs, attachments
  • βœ… Report HTML : Generates Default Robot Framework HTML Report

πŸ”„ Parallel Execution

  • This framework uses robotframework-pabot to execute tests in parallel:
#Split execution on test level instead of default suite level
pabot --testlevelsplit
  • You can also control the number of workers:
#How many parallel executors to use (default max of 2 and cpu count).
pabot --processes

πŸ§ͺ How to Run Tests

Pre-requisites

  • You should have python & allure cli installed on your system, if not please install
  • Python
  • Allure CLI here
  • IDE of your choice for ex: Pycharm Or VS Code
  • Clone/download the repo on your system, open in IDE or navigate to project root directory

1. πŸ“¦ Install Dependencies

pip install -r requirements.txt

2. πŸ“¦ Run All Tests (with Allure and HTML reports)

pabot --processes 3 --loglevel TRACE -d results --listener allure_robotframework:allure-results testcases

3. πŸ“¦ Generating Allure Report

allure generate allure-results -o allure-report --clean

4. πŸ“¦ Opening Allure And Robot Framework Default HTML Reports in browser

# Open Robot Framework Default Report
Start-Process "results\report.html"
# Open Allure Report
Start-Process "allure" -ArgumentList "open", "allure-report"

5. πŸ“¦ Or directly run runtest.ps1 in powershell mode if python and allure-cli is installed

  • This will first clear the
    • allure-results: directory that generates with xml and json files for allure report generation post test execution, so that we get fresh version of these file on each run
    • results: directory that contains the report.html i.e, self-contained html report generated by pytest-html
    • logs: directory containing separate log file for each executed test in parallel mode using pytest-xdist
  • Install dependencies as mentioned in step 1
  • Run All Tests with Allure, HTML reports options leveraging robotframework-pabot option --processes 3 to distribute 3 tests at a time based on file for parallel testing as per step 2
  • Generate allure report in allure-report directory based on xml/json file generated in allure-results directory as per step 3
  • Directly open Robot Framework Default HTML Report from results\report.html directory and interactive allure report from allure-report in your system default browser as per step 4

πŸ“Š Sample Reports

βœ… Allure Report

sample1 sample2

βœ… Robot Framework Default Report

pytest-html1 pytest-html2

πŸ™‹β€β™‚οΈ Author: Rohit Negi

About

This Framework created for UI automation based on Robot Framework and uses pabot for Parallel Testing

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages