Metadata-Version: 2.4
Name: krixs-test-for-complet-complaition
Version: 0.1.0
Summary: Krix's test for complet complaition - Unified software test reporting and AI/ML evaluation analytics with regression diagnostics.
Author-email: TestGraph Maintainers <maintainers@testgraph.dev>
License-Expression: Apache-2.0
Keywords: testing,analytics,regression,junit,ml-evaluation,reporting,flakiness
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.5.0
Requires-Dist: defusedxml>=0.7.1
Requires-Dist: plotly>=5.15.0
Requires-Dist: jinja2>=3.1.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: scikit-learn>=1.3.0; extra == "dev"
Requires-Dist: pandas>=2.0.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <h1 align="center">📊 TestGraph</h1>
  <p align="center"><strong>Unified Python Testing Analytics & Regression Diagnostics</strong></p>
  <p align="center">
    <em>Local-first test reporting, failure clustering, flakiness heuristics, and AI/ML model evaluation in a single interactive workflow.</em>
  </p>
</p>

---

## 🌟 Why TestGraph?

Modern software engineering teams frequently build hybrid architectures: backend APIs, distributed pipelines, and AI/ML inference models. When automated runs fail or degrade, developers are forced to navigate fragmented tools—traditional unit test runners on one hand, and specialized ML monitoring platforms on the other.

**TestGraph** unifies software test outcomes and ML evaluation metrics under a single, versioned data model:
- 🔒 **Local-First & Safe:** Zero daemons, zero external accounts, zero network calls. Uses `defusedxml` to neutralize XXE attacks and auto-escapes all untrusted stack traces.
- 📉 **Regression Diagnostics:** Automatically catches newly failing tests, execution slowdowns, and ML metric drops against baseline runs.
- 🔍 **Failure Clustering:** Normalizes volatile tokens (hex addresses, UUIDs, temporary paths) into deterministic signatures to group related errors.
- 🎲 **Historical Flakiness:** Tracks outcome transitions across historical runs, flagging flaky tests and warning when sample sizes are insufficient ($N < 5$).
- 🤖 **AI/ML Evaluation:** Built-in calculation of classification metrics (Accuracy, Macro/Weighted F1, Confusion Matrix) and latency benchmarks.
- 📊 **Standalone Interactive HTML:** Generates self-contained HTML reports with embedded Plotly charts that work completely offline.

---

## 🚀 Quick Start

### Installation

```bash
pip install testgraph-analytics
```

For development and additional data science tooling:
```bash
pip install "testgraph-analytics[dev]"
```

---

## 💻 Command-Line Interface (CLI)

TestGraph comes with a fast, versatile CLI:

### 1. Inspect Run Summary
```bash
testgraph summary reports/junit.xml
```

### 2. Compare Runs & Gate CI on Regressions
```bash
# Returns exit code 1 if regressions are detected (ideal for CI gates)
testgraph compare reports/baseline_junit.xml reports/current_junit.xml
```

### 3. Generate Standalone Interactive HTML Report
```bash
testgraph report reports/junit.xml -o reports/testgraph-report.html --baseline reports/baseline_junit.xml
```

### 4. Persist and Query Run History (SQLite)
```bash
# Save run to SQLite
testgraph record reports/junit.xml --db testgraph.db

# Inspect recent runs
testgraph history --db testgraph.db

# Detect flaky tests across historical executions
testgraph history --db testgraph.db --flaky

# View history of a specific test case
testgraph history --db testgraph.db --case "tests.test_api::test_health#4a1b8c2d"
```

---

## 🐍 Programmatic Python API

### Ingesting JUnit XML & Analyzing Failures

```python
from testgraph.ingestion import JUnitIngester
from testgraph.analytics import compute_run_summary, cluster_failures

# Safe parsing with defusedxml
ingester = JUnitIngester()
run = ingester.parse_file("reports/junit.xml")

# Outcome summary
summary = compute_run_summary(run)
print(
    f"Pass Rate: {summary.effective_pass_rate * 100:.1f}% ({summary.passed}/{summary.total_tests})"
)

# Deterministic failure clustering
clusters = cluster_failures(run)
for c in clusters:
    print(f"[{c.signature_id}] {c.count}x {c.error_type}: {c.normalized_message}")
```

### Unifying ML Evaluations & Software Tests

```python
from testgraph.models import TestRun
from testgraph.ml import create_evaluation
from testgraph.report import ReportRenderer

# Compute ML classification metrics & latency
ml_eval = create_evaluation(
    model_name="fraud_classifier_v2",
    y_true=["legit", "fraud", "legit", "fraud"],
    y_pred=["legit", "legit", "legit", "fraud"],
    latencies_ms=[14.2, 18.5, 12.1, 15.0],
)

# Attach to TestRun
run = TestRun(source="ml_pipeline")
run.ml_evaluations.append(ml_eval)

# Generate interactive standalone HTML report
renderer = ReportRenderer()
renderer.render_to_file(run, "reports/ml_and_tests.html")
```

---

## 🛠️ GitHub Actions CI Integration

Add TestGraph to your GitHub Actions workflow for automated regression gating and HTML report artifacts:

```yaml
name: Test Suite & Analytics

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install Dependencies
        run: |
          pip install -e .
          pip install pytest

      - name: Run Pytest
        run: |
          pytest -v --junitxml=reports/current.xml

      - name: Gate on Regressions
        if: always()
        run: |
          # Compare with baseline if present
          if [ -f "reports/baseline.xml" ]; then
            testgraph compare reports/baseline.xml reports/current.xml
          fi

      - name: Generate HTML Report
        if: always()
        run: |
          testgraph report reports/current.xml -o reports/testgraph-report.html

      - name: Upload Report Artifact
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: testgraph-html-report
          path: reports/testgraph-report.html
```

---

## 📚 Documentation

- [Architecture & Design](docs/ARCHITECTURE.md)
- [Statistical Methods & Formulas](docs/STATISTICAL_METHODS.md)
- [Programmatic API Reference](docs/API.md)
- [Competitive Landscape Analysis](docs/COMPETITIVE_ANALYSIS.md)
- [Project Roadmap](docs/ROADMAP.md)

---

## 📄 License

TestGraph is released under the [Apache License 2.0](LICENSE).
