Skip to content

This project automates login testing with Behave and Selenium WebDriver, using BDD to verify login scenarios like valid and invalid credentials. The page object model (POM) keeps the code organized and easy to scale.

Notifications You must be signed in to change notification settings

Undisputed-jay/Behavior-Driven-Development-Testing-for-Ecommerce-Login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Behavior-Driven-Testing-for-LoginPage

Automated Login Testing with Behave and Selenium

This project automates login functionality testing for a web application using Behave and Selenium WebDriver, following the behavior-driven development (BDD) approach. The framework tests various login scenarios, such as successful logins, invalid email or password entries, and empty credential submissions, using Selenium WebDriver to interact with the web application. Built with the page object model (POM), the project separates page-specific logic for better maintainability.

Table of Contents

Project Overview

This test suite automates testing for the login functionality of a web application. Each test is written in a BDD style using Behave, and the steps interact with the web application through Selenium. The project utilizes a page object model for maintainable and reusable code.

Features

  • Login Functionality Testing: Validates successful and unsuccessful login attempts.
  • Page Object Model (POM): Separates page logic from test logic for readability and maintainability.
  • Timestamped Email Generation: Generates a unique email using a timestamp to test invalid email login attempts.

Setup Instructions

  1. Clone the Repository
    git clone <repository-url>
    cd <repository-folder>
  2. Install Dependencies
    pip install -r requirements.txt
  3. Set Up WebDriver Download the appropriate WebDriver for your browser (e.g., ChromeDriver for Chrome) and add it to your PATH.

Usage

  1. Run Tests
    behave

Folder Structure


├── features/
│   ├── login.feature           # Contains the login scenarios in Gherkin format
│   └── steps/
│       └── login_steps.py      # Step definitions for the login scenarios
├── pageobject/
│   ├── loginpage.py            # Page object for the login page
│   └── accountpage.py          # Page object for the account page after login
├── utils/
│   └── helper_functions.py     # Utility functions such as email generator
└── README.html                 # Project documentation

Scenarios Tested

  1. Successful Login: Validates that the user is redirected to the dashboard after entering valid credentials.
  2. Login with Invalid Email: Checks that an appropriate warning is displayed when an invalid email is used.
  3. Login with Invalid Password: Verifies that an error message is shown for incorrect passwords.
  4. Login with Missing Credentials: Ensures the correct warning is shown when no credentials are submitted.

Utility Functions

  • generate_email_with_timestamp(): Generates a unique email address for testing invalid email scenarios.

This project is designed to make testing the login functionality efficient and scalable, with a focus on ease of maintenance through the page object model.

About

This project automates login testing with Behave and Selenium WebDriver, using BDD to verify login scenarios like valid and invalid credentials. The page object model (POM) keeps the code organized and easy to scale.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published