Skip to content

Commit 0659b08

Browse files
docs: add local testing instructions and new test coverage script
1 parent b9907c8 commit 0659b08

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,31 @@ The setup script will:
3131
- Initialize Husky for git hooks (if present)
3232
- Add `.fvm/` to `.gitignore` if needed
3333

34+
## Testing
35+
36+
### Local Testing
37+
38+
Run tests with coverage locally:
39+
40+
```bash
41+
# Using the provided script (recommended)
42+
./scripts/test_with_coverage.sh
43+
44+
# Or manually
45+
fvm flutter test --coverage
46+
lcov --summary coverage/lcov.info
47+
genhtml coverage/lcov.info -o coverage/html
48+
open coverage/html/index.html
49+
```
50+
3451
## Contributing
3552

3653
Contributions are welcome! Please:
3754

3855
- Follow the existing code style and patterns
3956
- Write clear commit messages (Commitlint and Husky are enabled)
4057
- Add or update tests for new features or bug fixes
58+
- Ensure all tests pass before submitting a pull request
4159
- Open a pull request with a clear description
4260

4361
## License

scripts/test_with_coverage.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Flutter Policy Engine - Test with Coverage Script
4+
# This script runs all tests and generates coverage reports
5+
6+
set -e # Exit on any error
7+
8+
echo "🧪 Running Flutter tests with coverage..."
9+
10+
# Run tests with coverage
11+
fvm flutter test --coverage
12+
13+
echo "📊 Generating coverage summary..."
14+
lcov --summary coverage/lcov.info
15+
16+
echo "🌐 Generating HTML coverage report..."
17+
genhtml coverage/lcov.info -o coverage/html
18+
19+
echo "✅ Coverage report generated successfully!"
20+
echo "📁 HTML report available at: coverage/html/index.html"
21+
22+
# Open the coverage report in browser (macOS)
23+
if [[ "$OSTYPE" == "darwin"* ]]; then
24+
echo "🔗 Opening coverage report in browser..."
25+
open coverage/html/index.html
26+
else
27+
echo "📖 To view the coverage report, open: coverage/html/index.html"
28+
fi
29+
30+
echo "🎉 Test coverage process completed!"

0 commit comments

Comments
 (0)