This project automates login functionality testing using Selenium with Python and Pytest.
It verifies both valid and invalid login scenarios on a sample web application and automatically:
- β Generates an HTML test report
β οΈ Logs defects into a CSV file- πΈ Captures screenshots of failed test cases
- Automated functional testing of login page
- Validation of both correct and incorrect credentials
- Screenshot capture for failed tests
- Defect logging (timestamp, expected vs actual result)
- HTML report generation with test results summary
Before running the project, ensure the following are installed:
- Python 3.8+
- Google Chrome Browser
- ChromeDriver (auto-managed via
webdriver_manager)
Install the required packages by running:
pip install -r requirements.txt
qa_project
βββ selenium_tests/
β βββ test_login_valid.py # Valid login test
β βββ test_login_invalid.py # Invalid login test
β βββ conftest.py # Pytest configuration and setup
β βββ defect_logger.py # Logs failed test details
β βββ screenshots/ # Stores screenshots of failed tests
β βββ report.html # Generated HTML report
β βββ defects_log.csv # Logged defect details
β
βββ README.md # Project documentation
Step 1: Create & Activate Virtual Environment
cd selenium_tests
python -m venv venv
Activate the environment:
Windows: venv\Scripts\activate
macOS/Linux: source venv/bin/activate
Step 2: Install Dependencies
pip install selenium pytest pytest-html webdriver-manager
Execute Tests
Run all tests and generate the HTML report:
pytest conftest.py --html=report.html --self-contained-html
This command:
Runs all test cases
Generates a detailed HTML report
Saves it as report.html in the project directory
Captures screenshots automatically when any test fails
Step 4: View Results
After execution:
π Report: Open report.html in any browser
β οΈ Defects: Check defects_log.csv
πΈ Screenshots: Found in /screenshots folder
π§βπ» Author
M.RAM KUMAR
B.Tech. Computer Science Engineering
Vel Tech, Chennai
π Project: Automated Web Login Testing using Selenium and Pytest