Metadata-Version: 2.4
Name: pytest-rca-report
Version: 0.1.2
Summary: Interactive RCA report generator for pytest runs, with AI-based analysis and visual dashboard
Author-email: Keinar Elkayam <keinar.elkayam@kaleidoo.ai>
License: MIT
Project-URL: Homepage, https://github.com/keinar/pytest-rca-report
Project-URL: Repository, https://github.com/keinar/pytest-rca-report
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: python-dotenv
Requires-Dist: openai
Dynamic: license-file

# Pytest-RCA-Report

An interactive Root Cause Analysis (RCA) dashboard for any Pytest project.  
Quickly visualize, triage, and investigate test failures with actionable LLM-powered insights.

## Features

- **Visual summary** of all test results (pass/fail/skip), anomalies, and execution times.
- **Root Cause Analysis**: Highlights failing modules/scripts.
- **Interactive test table** with search, status filtering, and drilldown for each test case.
- **Classification of failures**: Distinguishes between likely real bugs and probable test/infrastructure issues.
- **Actionable recommendations** generated by LLM (e.g. GPT-4).
- **Downloadable results** in JSON/CSV.
- **Summary graphs** (pie/bar) and execution time distribution.
- **Responsive UI** – optimized for both desktop and mobile.
- **Works with any Pytest project**: Supports unit, integration, and end-to-end tests, as long as JUnit XML is generated.

---

## Demo

<p align="center">
  <img src="https://github.com/keinar/pytest-rca-report/raw/main/demo.gif" width="900" alt="RCA Dashboard Demo">
</p>


## Installation

```bash
pip install pytest-rca-report
```

## Usage

1. Run your tests with JUnit XML output:
   ```bash
   pytest --junitxml=pytest-results.xml
   ```
2. Generate the RCA report:
   ```bash
   pytest-rca-report
   ```
3. View the dashboard:
   ```bash
   python -m http.server --directory dashboard
   ```
   Then open [http://localhost:8000/index.html](http://localhost:8000/index.html) in your browser.


## Usage & Navigation

- **Results Summary:** Top summary of all tests.
- **Summary Graphs:** Pie & bar charts of pass/fail/skip.
- **Log Anomalies:** Aggregated errors and warnings across all tests.
- **Root Cause Analysis:** Failure counts per module/script.
- **Execution Time:** Histogram & slowest tests listed.
- **Actionable Recommendations:** Next steps as suggested by the LLM.
- **All Testcases Table:**  
  - Search any test by name.
  - Filter by status (Passed/Failed/Skipped).
  - Click any row for a detailed modal with properties and failure reason.
  - Download all results as JSON or CSV.
- **Failure Classification:** Clear separation between likely real bugs and possible test automation issues.

---


## Requirements

- Python 3.9+
- OpenAI API key (set as `OPENAI_API_KEY` in your environment)

## Troubleshooting

- If the dashboard doesn't load data, always serve the `dashboard` folder with a local web server (not by opening the HTML file directly).

## Roadmap / Suggestions

- Regression trend analysis between runs
- "Mark as Known Issue" UI
- Integration with defect tracking (Jira etc.)
- Team comments on test failures

