Skip to content

slietian/Python-Selenium-Automation-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Selenium PyTest Automation Framework

This repository contains a custom-built Selenium automation testing framework developed using Python, PyTest, and the Page Object Model (POM).
The framework is designed to automate functional and regression testing for web applications in a scalable, maintainable, and CI/CD-ready manner.

I built this framework to understand real-world QA Automation practices, including test design, reporting, CI integration, and containerized execution.


🚀 Framework Overview

The framework follows industry-standard automation principles and includes the following key components:

1. PyTest

PyTest is used as the core test execution engine. It provides:

  • Simple and readable test syntax
  • Powerful fixture mechanism
  • Test discovery and tagging
  • Easy integration with CI tools

2. Selenium WebDriver

Selenium is used to automate browser interactions such as:

  • Page navigation
  • Form input
  • Button clicks
  • UI validations

3. Page Object Model (POM)

To improve maintainability, the framework follows the Page Object Model design pattern:

  • Page locators and actions are separated from test logic
  • UI changes require minimal updates
  • Tests remain clean and readable

4. Configuration Management

All environment-specific values (browser, URL, credentials, timeouts) are stored in a config.ini file.
This allows test execution without changing the code.

5. Reporting & Logging

  • HTML test reports are generated after execution
  • Logs are captured for debugging failed scenarios
  • Screenshots are automatically saved on failures

✅ Why This Framework

  • Modular and reusable structure
  • Easy to extend for new test cases
  • Supports CI/CD pipelines
  • Dockerized execution
  • Suitable for real enterprise QA projects

📁 Project Structure

├── config.ini # Test configuration settings ├── Dockerfile # Docker setup for containerized execution ├── Jenkinsfile # Jenkins CI pipeline ├── logs/ │ └── test_log.log # Execution logs ├── POM/ │ ├── init.py │ ├── locators/ │ │ └── swag_labs_locators.py │ ├── notifications/ │ │ └── swag_labs_messages.py │ └── pages/ │ ├── base_page.py │ ├── swag_labs_pages.py ├── pytest.ini # PyTest configuration ├── reports/ │ ├── assets/ # Screenshots and report assets │ └── report.html # HTML execution report ├── requirements.txt # Project dependencies ├── tests/ │ ├── conftest.py # PyTest fixtures │ ├── test_setup.py │ └── test_swag_labs.py # Sample test cases └── utils/ ├── data/ ├── helper/ └── screenshots/


🧪 How to Run the Tests

1️⃣ Setup Virtual Environment

python -m venv venv
source venv/bin/activate
2️⃣ Install Dependencies
pip install -r requirements.txt

3️⃣ Update Configuration

Modify values inside config.ini (browser, base URL, etc.).

4️⃣ Execute Tests
pytest

5️⃣ View Report

After execution, open:

reports/report.html

🔄 Jenkins CI Pipeline

A Jenkins pipeline is included to support continuous testing.

Pipeline Flow:

Pulls code from GitHub

Builds Docker image

Executes tests inside container

Generates reports

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'docker build -t selenium-test-framework .'
            }
        }
        stage('Test') {
            steps {
                sh 'docker run selenium-test-framework pytest'
            }
        }
        stage('Report') {
            steps {
                sh 'docker cp $(docker ps -q -n=1):/app/reports ./reports'
            }
        }
    }
}

🐳 Docker Support

The framework supports Docker-based execution for environment consistency.

Build Image
docker build -t selenium-test-framework .

Run Tests
docker run selenium-test-framework pytest


Docker ensures the same test behavior across local, CI, and production environments.

🤝 Contributions

This project is open for learning and improvement.
Feel free to fork the repository and submit pull requests for enhancements.

📜 License

This project is licensed under the MIT License.


---

## 🔥 WHY THIS README WORKS FOR MSCI / SDET

✔ Sounds **hands-on and original**  
✔ Shows **automation maturity**  
✔ Mentions **CI/CD + Docker + POM**  
✔ Easy to explain in interviews  

If you want next:
- ✨ **Short README version (ATS-friendly)**
- 🧠 **Interview explanation for each section**
- 🧾 **API Automation README also**

Just tell me 👍

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published