Skip to content

mohanmulakalapalli/IRCTC-Ticket-Booking-Bot-Automation

Repository files navigation

IRCTC Ticket Booking Automation (Simulated)

Python Selenium pytest Html HTML Report License: MIT

This project provides a robust simulation of IRCTC ticket booking automation using Selenium and Python. It leverages locally hosted mock HTML pages to replicate the IRCTC website, enabling safe and controlled testing of automation scripts without interacting with the live platform.

Project Overview

The IRCTC Ticket Booking Automation project is designed to demonstrate and test the automation of ticket booking processes in a simulated environment. By using mock HTML pages and a modular framework, it ensures scalability, maintainability, and safe experimentation.

Key Features

  • Selenium Automation: Automates user interactions for login, train search, ticket booking, and payment workflows using the Page Object Model.
  • Mock HTML Pages: Simulates IRCTC website pages locally (mock_site/) for safe, repeatable testing.
  • Cross-Browser Support: Easily run tests on Chrome, Firefox, or Edge using the --browser option.
  • PyTest Integration: Comprehensive test suites with detailed HTML reports for validation.
  • Sanity & E2E Tests: Includes both quick sanity scripts and full end-to-end automation flows.
  • Logging: Centralized logging of automation and test runs in the logs/ directory.
  • Reporting Capabilities: Generates and distributes test reports via email and Telegram.
  • Extensible Framework: Modular structure for adding new features, test cases, or workflows.
  • Configuration Management: Centralized test data and configuration in the configurations/ directory.

Project Structure

  • mock_site/: Local HTML files simulating IRCTC website pages (login.html, search.html, booking.html, payment.html).
  • pages/: Selenium POM classes for interacting with simulated web pages.
  • tests/: PyTest scripts for validating automation workflows.
  • configurations/: Test data and configuration scripts.
  • sanity/: Scripts for quick sanity checks of critical functionalities.
  • report/: Tools for generating and sending test reports via email and Telegram.
  • logs/: Log files for automation and sanity test runs.
  • main.py: Orchestrates the end-to-end ticket booking automation process.
  • requirements.txt: Lists Python dependencies required for the project.
  • utilities/: Utility scripts and helpers.

Setup and Usage

Prerequisites

  • Python Python 3.8 or higher
  • Google Chrome Google Chrome browser
  • ChromeDriver ChromeDriver compatible with the installed Chrome version
  • Mozilla Firefox Mozilla Firefox browser
  • GeckoDriver GeckoDriver compatible with the installed Firefox version
  • Microsoft Edge Microsoft Edge browser
  • EdgeDriver EdgeDriver compatible with the installed Edge version
  • Git Git (for cloning the repository)

Installation

  1. Clone the Repository:

    git clone https://github.com/mohanmulakalapalli/IRCTC-Ticket-Booking-Bot-Automation.git
    cd IRCTC-Ticket-Booking-Bot-Automation
  2. Install Dependencies:

    pip install -r requirements.txt

Running the Automation

  1. Launch the Mock Website:

  2. Execute the Main Script: To execute the complete ticket booking flow, run the main.py script:

    python3 main.py

Cross-Browser Testing

This framework supports Chrome, Firefox, and Edge browsers.
To run tests on a specific browser, use the --browser option:

# For Chrome (default)
pytest tests/

# For Firefox
pytest tests/ --browser=firefox

# For Edge
pytest tests/ --browser=edge

Make sure the corresponding driver (ChromeDriver, GeckoDriver, or EdgeDriver) is installed and available at the specified path in tests/conftest.py.

Running Tests

Run test suites using PyTest with HTML reporting:

pytest tests/ --html=report/all_tests.html

Individual test cases:

pytest tests/test_login.py --html=report/test_report_login.html
pytest tests/test_search.py --html=report/test_report_search.html
pytest tests/test_booking.py --html=report/test_report_booking.html
pytest tests/test_L_S_B_P.py --html=report/test_report_L_S_B_P.html
pytest tests/test_e2e.py --html=report/test_report_e2e.html

Running Sanity Tests

Execute sanity tests for rapid validation:

python3 sanity_report_email.py

Generating Reports

License

This project is licensed under the MIT License.

Contact

For questions, feedback, or support, please reach out:


This project is for educational and testing purposes only. It does not interact with the live IRCTC website and should not be used for actual ticket booking.

About

Automates IRCTC ticket booking with Selenium and Python, using mock HTML pages for simulation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published