Skip to content

Commit 6d96f11

Browse files
committed
adding examples
1 parent fea5b42 commit 6d96f11

16 files changed

Lines changed: 2930 additions & 27 deletions

.gitignore_reports

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Generated reports
2+
reports/*.html
3+
reports/*.csv
4+
reports/*.md
5+
!reports/.gitkeep

README.md

Lines changed: 85 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,60 +23,117 @@
2323
## 📦 Installation
2424

2525
```bash
26-
## 📦 Installation
26+
pip install testiq
27+
```
28+
29+
---
30+
31+
## 🚀 How to Use TestIQ
2732

33+
### Quick Start
34+
35+
**See it in action immediately:**
2836
```bash
29-
pip install testiq
37+
testiq demo
3038
```
3139

32-
## 🎯 Quick Start
40+
### CLI Usage
3341

34-
### 1. Analyze Your Tests
42+
#### 1. Analyze Your Tests
3543

3644
```bash
3745
# Basic analysis with terminal output
3846
testiq analyze coverage.json
3947

4048
# Generate beautiful HTML report
41-
testiq analyze coverage.json --format html --output report.html
42-
43-
# CSV export for data analysis
44-
testiq analyze coverage.json --format csv --output duplicates.csv
49+
testiq analyze coverage.json --format html --output reports/report.html
4550

46-
# JSON output for programmatic use
47-
testiq analyze coverage.json --format json --output results.json
48-
```
51+
# Get quality score and recommendations
52+
testiq quality-score coverage.json
4953

50-
---
54+
# CSV export for spreadsheet analysis
55+
testiq analyze coverage.json --format csv --output reports/results.csv
5156

52-
## 🎯 Quick Start
57+
# JSON output for automation
58+
testiq analyze coverage.json --format json --output reports/results.json
59+
```
5360

54-
**CLI Usage:**
61+
#### 2. CI/CD Integration
5562

5663
```bash
57-
# Analyze tests and generate report
58-
testiq analyze coverage.json --format html --output report.html
64+
# Quality gates (exit code 2 if failed)
65+
testiq analyze coverage.json --quality-gate --max-duplicates 5
5966

60-
# Get quality score
61-
testiq quality-score coverage.json
67+
# Save baseline for future comparisons
68+
testiq analyze coverage.json --save-baseline my-baseline
6269

63-
# CI/CD with quality gates
64-
testiq analyze coverage.json --quality-gate --max-duplicates 5
70+
# Compare against baseline
71+
testiq analyze coverage.json --quality-gate --baseline my-baseline
72+
73+
# Manage baselines
74+
testiq baseline list
75+
testiq baseline show my-baseline
76+
testiq baseline delete old-baseline
6577
```
6678

67-
**Python API:**
79+
#### 3. Python API
6880

6981
```python
7082
from testiq.analyzer import CoverageDuplicateFinder
83+
import json
84+
85+
# Create analyzer with performance options
86+
finder = CoverageDuplicateFinder(
87+
enable_parallel=True,
88+
max_workers=4,
89+
enable_caching=True
90+
)
91+
92+
# Load coverage data
93+
with open('coverage.json') as f:
94+
coverage_data = json.load(f)
95+
96+
# Add test coverage
97+
for test_name, test_coverage in coverage_data.items():
98+
finder.add_test_coverage(test_name, test_coverage)
99+
100+
# Find issues
101+
exact_duplicates = finder.find_exact_duplicates()
102+
subset_duplicates = finder.find_subset_duplicates()
103+
similar_tests = finder.find_similar_coverage(threshold=0.8)
104+
105+
# Generate reports
106+
from testiq.reporting import HTMLReportGenerator
107+
html_gen = HTMLReportGenerator(finder)
108+
html_gen.generate(Path("reports/report.html"), threshold=0.8)
109+
110+
# Quality analysis
111+
from testiq.analysis import QualityAnalyzer
112+
analyzer = QualityAnalyzer(finder)
113+
score = analyzer.calculate_score(threshold=0.8)
114+
print(f"Quality Score: {score.overall_score}/100 (Grade: {score.grade})")
115+
```
71116

72-
finder = CoverageDuplicateFinder()
73-
finder.add_test_coverage("test_login", {"auth.py": [10, 11, 12]})
117+
#### 4. Examples & Testing
74118

75-
duplicates = finder.find_exact_duplicates()
76-
report = finder.generate_report()
77-
```
119+
**See complete working examples:**
120+
- 📁 **[Python API Examples](examples/python/)** - Complete demonstration of all features
121+
- 📁 **[Bash Examples](examples/bash/)** - Quick CLI testing scripts
122+
- 📁 **[CI/CD Examples](examples/cicd/)** - Jenkins & GitHub Actions integration
123+
- 📖 **[Manual Testing Guide](docs/manual-testing.md)** - Comprehensive testing guide
124+
125+
**CI/CD Integration:**
126+
- [Jenkinsfile Example](examples/cicd/Jenkinsfile) - Complete Jenkins pipeline with quality gates
127+
- [GitHub Actions Example](examples/cicd/github-actions.yml) - Full workflow with error handling
128+
129+
---
130+
131+
### Next Steps
78132

79-
📖 **[Full Documentation →](docs/README.md)** | **[User Guide →](docs/guide.md)** | **[API Reference →](docs/api.md)**
133+
1. **Try the demo:** `testiq demo`
134+
2. **Analyze your tests:** `testiq analyze coverage.json`
135+
3. **Run examples:** `python examples/python/manual_test.py`
136+
4. **Integrate with CI/CD:** See [examples/cicd/](examples/cicd/)
80137

81138
---
82139

@@ -98,6 +155,7 @@ report = finder.generate_report()
98155
| **[CLI Reference](docs/cli-reference.md)** | Command-line interface documentation |
99156
| **[API Reference](docs/api.md)** | Python API documentation |
100157
| **[Integration Guide](docs/integration.md)** | pytest, unittest, GitHub Actions |
158+
| **[Manual Testing Guide](docs/manual-testing.md)** | How to test TestIQ manually |
101159
| **[Enterprise Features](docs/enterprise-features.md)** | Advanced capabilities |
102160
| **[FAQ](docs/faq.md)** | Frequently asked questions |
103161
| **[Contributing](docs/CONTRIBUTING.md)** | How to contribute |

0 commit comments

Comments
 (0)