Skip to content

imranc07/PAT_Task12

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Driven Test Framework (DDF) using Page Object Model (POM)

Website Link: https://opensource-demo.orangehrmlive.com/web/index.php/auth/login

Test Objective

The objective is to automate testing of the login functionality for the OrangeHRM demo website by using test data from an Excel file. The test will be executed using the Pytest framework and a Data Driven Test Framework (DDF) with the Page Object Model (POM) design pattern. The process includes adding test data to the Excel file, performing login tests based on that data, and shutting down the browser after the test execution

Table of Contents

Features

  • Data-Driven Testing Framework (DDF): Test data is fetched from an external Excel file, enabling the execution of tests with multiple data sets without modifying the test scripts.
  • Page Object Model (POM): Separation of test logic and UI interactions. Each web page has its own corresponding class that defines methods for interacting with the elements on that page.
  • Pytest Framework: Used to manage test cases, execute tests, and generate detailed reports.
  • Excel Integration: Test data for login credentials is stored and retrieved from an Excel file, making it easy to add, modify, or scale test data without changing code.
  • Reusable Components: Common actions like login, navigating to sections, and performing shutdown operations are encapsulated in reusable methods, improving maintainability.
  • Cross-Platform Compatibility: The framework can be run across different environments, supporting different operating systems and web browsers.
  • Automation and Reporting: Automation of repetitive tests with detailed reports on test results, making it easier to monitor and debug test executions.

Tech Stack

  • Programming Language: Python
  • Test Framework: pytest and DDF
  • Automation Tool: Selenium WebDriver
  • Reporting: pytest-html
  • Browser Compatibility: Chrome, Firefox, and optionally, Edge

Running Tests

To execute tests, use the following commands:

  1. Run All Tests:
pytest
  1. Generate HTML Report:
pytest --html=Reports/test_report.html
  1. Headless Browser Execution:
You can set up tests to run in headless mode directly in your test script.
  1. Incognito Mode Execution:
You can set up tests to run in Incognito mode directly in your test script.

Project Structure

Task_12/
│
├── TestScript/
│   └── test_login.py          # Main test script for data-driven login functionality
│
├── TestLocators/
│   └── locators.py            # Contains locators for various elements on the OrangeHRM page
│
├── TestData/
│   └── data.py                # Contains test data such as URL, Excel file details, and dashboard URL
│
├── Utilities/
│   └── excel_functions.py     # Utility functions to interact with the Excel file (read/write data)
│
├── Reports/
│   └── test_report.html       # HTML test report generated by pytest-html
│
└── README.md                  # Project documentation