Metadata-Version: 2.4
Name: test-reporting
Version: 1.0.0
Summary: Beautiful multi-project test reporting dashboard system
Home-page: https://github.com/amahdy77/test-reporting.git
Author: Ashfaqur Mahdy
Author-email: amahdy00@gmail.com
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pytest>=8.0.0
Provides-Extra: playwright
Requires-Dist: playwright>=1.40.0; extra == "playwright"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 🚀 Test Reporting System

A beautiful, multi-project test reporting dashboard system for Playwright/Pytest with shared database support.

---

## ✨ Features

- 📊 **Beautiful Dashboards** - Interactive HTML dashboards with charts and metrics
- 🎯 **Multi-Project Support** - Multiple projects share one database
- 🔍 **Advanced Analytics** - Flaky tests, failure patterns, performance tracking
- 📈 **Trend Analysis** - Track quality over time
- 🎨 **Projects Landing Page** - Overview of all your test projects
- 🔒 **Concurrent Safe** - SQLite WAL mode for parallel test runs
- 📦 **Easy Integration** - Simple pip install and config

---

## 🚀 Quick Start

### **Installation**

```bash
# Install from PyPI
pip install test-reporting

# Or install from source for development
git clone https://github.com/yourusername/test-reporting.git
cd test-reporting
pip install -e .
```

### **Setup in Your Test Project**

1. **Add to conftest.py:**

```python
# conftest.py
pytest_plugins = ['reporting.plugin']
```

2. **Create reporting.ini:**

```ini
# reporting.ini
[reporting]
project_name = My Test Project
db_path = test_results.db
dashboard_dir = dashboard
retention_days = 365
```

3. **Run tests:**

```bash
pytest
```

4. **Generate dashboards:**

```bash
test-report generate
# or
python -m reporting.cli generate
```

5. **Open dashboards:**

```bash
test-report open
```

---

## 📊 Dashboards

### **Projects Landing Page**
- Overview of all projects
- Health scores
- Quick metrics
- Click to drill down

### **Overview Dashboard**
- Overall health metrics
- Module breakdown
- Failure hotspots
- Quality trends
- Flaky tests
- Performance metrics

### **Run Details Dashboard**
- Latest test run details
- Test-by-test breakdown
- Screenshots and traces
- Error messages
- Execution logs

### **Test History**
- All test runs
- Search and filter
- Trend analysis
- Compare runs

---

## 🎯 Multi-Project Setup

### **Shared Database**

All projects can share one database:

```
workspace/
├── shared_test_results.db          ← Single database
│
├── project-a/
│   ├── tests/
│   └── reporting.ini               ← project_name = Project A
│
├── project-b/
│   ├── tests/
│   └── reporting.ini               ← project_name = Project B
│
└── project-c/
    ├── tests/
    └── reporting.ini               ← project_name = Project C
```

Each project's data is tagged with its project name. The landing page shows all projects.

---

## ⚙️ Configuration

### **reporting.ini**

```ini
[reporting]
# Required: Unique project identifier
project_name = My Test Project

# Required: Database location (can be shared across projects)
db_path = test_results.db

# Optional: Dashboard output directory (default: dashboard)
dashboard_dir = dashboard

# Optional: Data retention in days (default: 365)
retention_days = 365
```

### **Environment Variables (Alternative)**

```bash
export PROJECT_NAME="My Test Project"
export DB_PATH="test_results.db"
```

Config file takes precedence if it exists.

---

## 🛠️ CLI Commands

```bash
# Generate all dashboards
test-report generate

# Generate and open in browser
test-report open

# Show quick stats
test-report stats

# Show suite statistics
test-report suites

# Clean up old data
test-report cleanup
```

---

## 📈 Metrics Tracked

### **Top 10 Quick Win Metrics:**

1. **Retry Analysis** - Tests that needed retries
2. **Failure Type Breakdown** - Categorized failures
3. **Time to Recovery** - How long failures persist
4. **Performance Regressions** - Slower tests over time
5. **Failure Correlations** - Tests that fail together
6. **Error Message Search** - Common error patterns
7. **Test Age Analysis** - Old vs new test stability
8. **Soft Fail Analysis** - Timeout and flaky patterns
9. **Step-Level Failures** - Where tests break
10. **Module Health** - Health by test file

### **Core Metrics:**

- Pass rate (overall and functional)
- Test duration
- Flaky test detection
- Failure hotspots
- Quality trends
- Module health

---

## 🔒 Concurrency

Uses SQLite WAL mode for safe concurrent writes:

```python
# Multiple projects can run tests simultaneously
Project A → test_results.db ← Safe!
Project B → test_results.db ← Safe!
Project C → test_results.db ← Safe!
```

---

## 🎨 Screenshots

### Projects Landing Page
```
┌────────────────────────────────────────┐
│  🚀 Test Automation Projects           │
├────────────────────────────────────────┤
│  ┌──────────────────────────────────┐  │
│  │ ✅ Project A                     │  │
│  │ Health Score: 95%                │  │
│  │ 120 Tests | 50 Runs              │  │
│  │ [View Dashboard →]               │  │
│  └──────────────────────────────────┘  │
│  ┌──────────────────────────────────┐  │
│  │ ⚠️ Project B                     │  │
│  │ Health Score: 78%                │  │
│  │ 85 Tests | 30 Runs               │  │
│  │ [View Dashboard →]               │  │
│  └──────────────────────────────────┘  │
└────────────────────────────────────────┘
```

---

## 🔧 Development

### **Setup for Development**

```bash
# Clone repo
git clone https://github.com/yourusername/test-reporting.git
cd test-reporting

# Install in editable mode
pip install -e .

# Make changes
# Test in your project
```

### **Project Structure**

```
test-reporting/
├── reporting/
│   ├── __init__.py
│   ├── plugin.py              # Pytest plugin
│   ├── storage.py             # Database operations
│   ├── config.py              # Configuration
│   ├── cli.py                 # CLI commands
│   ├── classifier.py          # Failure classification
│   ├── overview_dashboard.py  # Overview dashboard
│   ├── dashboard_generator_v2.py  # Run details
│   ├── history_dashboard.py   # Test history
│   └── projects_dashboard.py  # Projects landing
├── setup.py
├── README.md
├── requirements.txt
└── .gitignore
```

---

## 📦 Requirements

- Python >= 3.9
- pytest >= 8.0.0
- playwright >= 1.40.0 (optional, for web tests)

---

## 🚀 CI/CD Integration

### **Jenkins**

```groovy
stage('Run Tests') {
    steps {
        sh 'pytest'
        sh 'test-report generate'
        archiveArtifacts artifacts: 'dashboard/**/*'
    }
}
```

### **GitHub Actions**

```yaml
- name: Run Tests
  run: pytest

- name: Generate Reports
  run: test-report generate

- name: Upload Dashboards
  uses: actions/upload-artifact@v2
  with:
    name: test-dashboards
    path: dashboard/
```

---

## 📝 License

MIT License - See LICENSE file

---

## 🤝 Contributing

1. Fork the repo
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Make changes
4. Test thoroughly
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request

---

## 📧 Support

- Issues: https://github.com/yourusername/test-reporting/issues
- Documentation: See README and SETUP_GUIDE.md

---

## 🎉 Credits

Built with ❤️ for better test reporting

---

**Happy Testing!** 🚀📊✨
