Automated browser tests simulating user interactions, implemented with Selenium and Pytest.
This project automates user interactions in a browser, such as clicks and inputs, and verifies expected outcomes using assertions.
It is part of my personal learning journey into test automation. Over time, I have been improving the project by adding features like structured tests, logging, and setup/teardown logic to simulate a more realistic project environment.
As I am still learning and growing in this area, I am always open to feedback and suggestions.
- Automated testing of browser-based user interactions
- Test case covers verifying successful login on a webpage
- Automated screenshots and logging during test run
- Clean folder structure
- Applied Object-Oriented Programming (OOP) principles
- Setup and teardown routines via
conftest.py - Easy to extend and maintain
The project follows a simple structure that separates application code from tests:
project/
├───src/ -> Source code
├───tests/ -> Test case(s) and related files
│ ├───logs/ -> Logs are generated during test run
│ ├───reports/ -> HTML test reports (can be generated from a command line)
│ ├───screenshots/ -> Sreenshots are captured during test run
-
Programming Language:
Developed and tested with Python 3.11.
Download Python at: https://www.python.org/downloads/ -
Python Packages:
See requirements.txt for all dependencies.
Option A – Clone via Git
git clone https://github.com/vans-codelab/pytest-selenium-login-test
cd pytest-selenium-login-test Option B – Download ZIP from GitHub
Download ZIP from GitHub and extract it. Then navigate to the extracted folder with the following command:
cd <path-to-extracted-project-folder> # Replace with the actual folder pathWindows:
python -m venv .venv
.venv\Scripts\activatemacOS/Linux:
python -m venv .venv
source .venv/bin/activatepip install -r requirements.txtThis option is recommended for executing the full test suite.
-
Ensure that the virtual environment of the downloaded project is activated (if not already done).
cd <project-folder-path> # Replace with the actual folder path
Windows:
.venv\Scripts\activate
macOS/Linux:
source .venv/bin/activate -
Run all test cases
pytest
To run a single test case or for easier debugging, an IDE can be used.
- Open the project folder in an IDE (e.g. PyCharm).
- Ensure that the virtual environment is selected.
- Run individual test files using the IDE's built-in test runner.
A reports/ folder is included in the project structure to store HTML test reports.
After running the test, a report can be generated by running the following command:
pytest --html=tests/reports/report.htmlThis will create a HTML report inside the reports/ folder.
The report provides an overview of the executed test case(s) and their results.
This project is licensed under the MIT License - see the LICENSE file for more information.