Skip to content

SQL-driven test validation with property-based testing. Validates data integrity, account balances, and transaction status using pytest and SQLite.

Notifications You must be signed in to change notification settings

joemarino-dev/database-testing-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database Testing with Python

Demonstrates SQL-driven test validation using pytest and SQLite.

What This Shows

  • Property-based testing for data integrity
  • SQL query validation
  • Database fixture management
  • Test data setup and teardown

Setup

Create and activate a virtual environment:

On Mac/Linux:

python3 -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
venv\Scripts\activate

Install dependencies:

pip install -r requirements.txt

Set up test database:

On Mac/Linux:

python3 setup_test_db.py

On Windows:

python setup_test_db.py

Run Tests

From the project root:

pytest

Test Coverage

  • Balance Integrity: Property-based validation that account_balance = deposits - withdrawals
  • User Count: Validates expected number of test users
  • User Existence: Checks for specific test users
  • Transaction Status: Validates transaction completion status
  • User Balance: Validates individual user balance calculations
  • User Transactions: Validates transaction history per user

About

SQL-driven test validation with property-based testing. Validates data integrity, account balances, and transaction status using pytest and SQLite.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages