Pytest plugin to keep a history of your pytest runs
Project description
pytest-history
Pytest plugin to keep history of your pytest runs
Overview
pytest-history
enables the tracking of test statuses and other metadata across multiple test runs, providing additional insights into test behavior.
Initially, this plugin was developed specifically to identify potentially flaky tests (approximately 200) within a test suite containing over 1000 tests, where various tests exhibited inconsistent behavior by failing on alternate runs.
Purpose
- Tracking Test History: Capturing and storing historical test results, encompassing pass, fail, and other pertinent metadata.
- Identifying Flaky Tests: Enabling the identification of flaky tests by scrutinizing historical data, detecting irregularities or recurring patterns in test outcomes.
- Facilitating Debugging: Offering developers and testers insights into test stability, thereby assisting in debugging efforts and enhancing overall test reliability.
Usage
- Install the plugin using
pip install pytest-history
. - Utilize the historical data stored in
.test-results.db
(SQLite database).
Example Queries
Example: To find flaky tests between two distinct test runs, execute the following SQL query:
SELECT t1.testcase, t1.test_run, t2.test_run, t1.outcome, t2.outcome
FROM "test.results" t1
JOIN "test.results" t2 on t1.testcase = t2.testcase AND (t1.test_run = 1 AND t2.test_run = 2)
WHERE (t1.outcome = 'passed' AND t2.outcome = 'failed')
OR (t1.outcome = 'failed' AND t2.outcome = 'passed')
GROUP BY t1.testcase
ORDER BY t1.testcase;
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest_history-0.1.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for pytest_history-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b558ab16b18ee3d963d21ef76414cf29e8d51b40fecbd6a44b0976b6202206f |
|
MD5 | cde651cf17da1e92488c4863277b9183 |
|
BLAKE2b-256 | 6c62bfdc741b687c3eb1008f520391c367517e39644d30079ac215cf4c7b248e |