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.
- Project Overview
- Features
- Setup Instructions
- Usage
- Folder Structure
- Scenarios Tested
- Utility Functions
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.
- 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.
- Clone the Repository
git clone <repository-url> cd <repository-folder>
- Install Dependencies
pip install -r requirements.txt
- Set Up WebDriver Download the appropriate WebDriver for your browser (e.g., ChromeDriver for Chrome) and add it to your PATH.
- Run Tests
behave
├── 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
- Successful Login: Validates that the user is redirected to the dashboard after entering valid credentials.
- Login with Invalid Email: Checks that an appropriate warning is displayed when an invalid email is used.
- Login with Invalid Password: Verifies that an error message is shown for incorrect passwords.
- Login with Missing Credentials: Ensures the correct warning is shown when no credentials are submitted.
- 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.