Skip to content

vans-codelab/pytest-selenium-login-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test automation (web browsing)

Automated browser tests simulating user interactions, implemented with Selenium and Pytest.

Project overview

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.

Features

  • 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

Project structure

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

Requirements

Project setup

1. Download the project

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 path

2. Create a virtual environment and activate it

Windows:

python -m venv .venv
.venv\Scripts\activate

macOS/Linux:

python -m venv .venv
source .venv/bin/activate

3. Install required packages

pip install -r requirements.txt

Run the test

Option 1 (recommended) – Using the terminal or command line:

This 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 

Option 2 (optional) – Using an IDE (e.g. PyCharm):

To run a single test case or for easier debugging, an IDE can be used.

  1. Open the project folder in an IDE (e.g. PyCharm).
  2. Ensure that the virtual environment is selected.
  3. Run individual test files using the IDE's built-in test runner.

Test report (optional)

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.html

This will create a HTML report inside the reports/ folder.
The report provides an overview of the executed test case(s) and their results.

License

This project is licensed under the MIT License - see the LICENSE file for more information.

About

Automated browser tests simulating user interactions, implemented with Selenium and Pytest

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages