Skip to content

Adilforest/sqat-assignment-5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Software QA & Testing — Assignment 5 (AITU)

Python Selenium pytest pytest-html

Overview

Assignment 5 for the Software Quality Assurance and Testing course at Astana IT University. Focuses on test lifecycle management, structured logging, and HTML reporting in Python — concepts equivalent to TestNG annotations and Log4j used in Java-based SQAT courses. Target site: the-internet.herokuapp.com/login.

What it covers

  • pytest fixtures with scopes — session, class, and function level lifecycle hooks (equivalent to @BeforeSuite/@AfterSuite, @BeforeClass/@AfterClass, @BeforeMethod/@AfterMethod)
  • Structured logginglogging module with console and file handlers (equivalent to Log4j)
  • pytest-html reports — automatic HTML report with embedded screenshots on test failure
  • Page Object ModelLoginPage class with locator constants and action methods
  • Driver factory — centralized create_driver() with headless support via HEADLESS=1 env var
  • Screenshot hookpytest_runtest_makereport captures screenshots on failure and embeds them in the HTML report
  • Valid and invalid login scenarios with flash-message assertions

Project structure

Assignment_5_SQAT/
├── pages/
│   └── login_page.py         # LoginPage POM class
├── tests/
│   ├── conftest.py           # Fixtures: session/class/function setup + screenshot hook
│   └── test_login.py         # Test class with valid and invalid login cases
├── utils/
│   ├── driver_factory.py     # Chrome WebDriver factory (headless-capable)
│   ├── logging_config.py     # Logging setup (console + file)
│   └── screenshot.py         # Screenshot helper used by the conftest hook
├── reports/
│   └── pytest-report.html    # Generated HTML report from last run
├── pytest.ini                # pytest config (--html report path, testpaths)
└── requirements.txt

Getting started

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Run tests:

pytest

Run headless:

HEADLESS=1 pytest

Output

Artifact Path
HTML report reports/pytest-report.html
Log file reports/test-run.log
Failure screenshots reports/screenshots/

Adil Ormanov — GitHub

About

Software QA & Testing — Assignment 5: pytest lifecycle fixtures, logging, HTML reports (AITU)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors