|
| 1 | +# Test Coverage Improvement Plan |
| 2 | + |
| 3 | +## Current Status (2026-03-04) |
| 4 | + |
| 5 | +### Test Coverage Summary |
| 6 | +- **Overall**: 19.0% |
| 7 | +- **Core Modules**: ~25% (needs improvement) |
| 8 | +- **Router**: ~11% (critical) |
| 9 | +- **Tree**: ~10% (critical) |
| 10 | +- **Upload**: 0% (no tests) |
| 11 | +- **Session**: 23.5% |
| 12 | +- **JSON**: 77.8% ✅ |
| 13 | +- **String**: 78.6% ✅ |
| 14 | + |
| 15 | +## Goals |
| 16 | + |
| 17 | +### Phase 1: Core Testing (Target: 35%+) |
| 18 | +- [ ] Add router_test.go tests |
| 19 | +- [ ] Add tree_test.go tests |
| 20 | +- [ ] Add uploadfile_test.go tests |
| 21 | +- [ ] Improve group_test.go coverage |
| 22 | + |
| 23 | +### Phase 2: Edge Cases (Target: 45%+) |
| 24 | +- [ ] Route conflict tests |
| 25 | +- [ ] Parameter parsing edge cases |
| 26 | +- [ ] Session concurrent tests |
| 27 | +- [ ] Middleware chain tests |
| 28 | + |
| 29 | +### Phase 3: Benchmarks |
| 30 | +- [ ] Router matching benchmarks |
| 31 | +- [ ] Session read/write benchmarks |
| 32 | +- [ ] Middleware chain benchmarks |
| 33 | + |
| 34 | +## Running Tests |
| 35 | + |
| 36 | +```bash |
| 37 | +# Run all tests with coverage |
| 38 | +go test ./... -coverprofile=coverage.out |
| 39 | + |
| 40 | +# View coverage report |
| 41 | +go tool cover -func=coverage.out |
| 42 | + |
| 43 | +# Generate HTML coverage report |
| 44 | +go tool cover -html=coverage.out -o coverage.html |
| 45 | +``` |
| 46 | + |
| 47 | +## Test Naming Convention |
| 48 | + |
| 49 | +``` |
| 50 | +Test<FunctionName>_<Scenario>_<ExpectedResult> |
| 51 | +
|
| 52 | +Examples: |
| 53 | +- TestRouter_AddRoute_ValidPath_Success |
| 54 | +- TestRouter_AddRoute_EmptyPath_Error |
| 55 | +- TestGroup_Use_MiddlewareChain_Order |
| 56 | +``` |
| 57 | + |
| 58 | +## CI Integration |
| 59 | + |
| 60 | +GitHub Actions workflow in `.github/workflows/test.yml` runs on: |
| 61 | +- Push to aicode, master branches |
| 62 | +- Pull requests |
0 commit comments