Skip to content

Commit 0362711

Browse files
committed
Add comprehensive test suite for IFSC Release Manager skill
Created automated test suite with 12 test categories covering: - Skill file structure (18 sub-skills validation) - Data source files (RBI NEFT/RTGS) - Python Excel converter - Generated datasets (5 formats) - IFSC format validation - Bank count validation - Patch files (23+ YAML files) - Git repository state - Release decision logic - Export format validation - Checksum comparison - Ruby scraper environment Features: - Color-coded output (PASS/FAIL/WARN/INFO) - Exit code 0/1 for CI/CD integration - Comprehensive test coverage (65+ tests) - README with usage instructions Usage: ./.claude/skills/ifsc-release-manager/tests/skill-test.sh Can be run: - Weekly for regular validation - Before releases - After skill modifications - In CI/CD pipelines 🤖 Generated with Claude Code
1 parent 64611cd commit 0362711

File tree

2 files changed

+640
-0
lines changed

2 files changed

+640
-0
lines changed
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# IFSC Release Manager - Test Suite
2+
3+
Automated tests to validate the IFSC Release Manager skill functionality.
4+
5+
## Running Tests
6+
7+
### Quick Test
8+
```bash
9+
cd /Users/vikas.naidu/code/rzp/ifsc
10+
./.claude/skills/ifsc-release-manager/tests/skill-test.sh
11+
```
12+
13+
### What Gets Tested
14+
15+
The test suite validates 12 critical areas:
16+
17+
1. **Skill File Structure**
18+
- Main skill file exists
19+
- All 18 sub-skills present
20+
- Context files available
21+
22+
2. **Data Source Files**
23+
- RBI NEFT file (68774.xlsx)
24+
- RBI RTGS file (RTGEB0815.xlsx)
25+
- CSV conversion files (5 files)
26+
27+
3. **Python Excel Converter**
28+
- convert_excel.py exists
29+
- pandas and openpyxl dependencies
30+
31+
4. **Generated Dataset Files**
32+
- IFSC.csv (34 MB, 177K+ entries)
33+
- IFSC.json (1 MB, compact format)
34+
- IFSC-list.json (2.4 MB, validation list)
35+
- banks.json (293 KB, 1,346 banks)
36+
- sublet.json (28 KB, sublet mappings)
37+
- by-bank/*.json (1,300+ files)
38+
39+
5. **IFSC Format Validation**
40+
- Count within range (170K-180K)
41+
- Format: `[A-Z]{4}0[A-Z0-9]{6}`
42+
- Sample validation (1000 entries)
43+
44+
6. **Bank Count Validation**
45+
- Range: 1,300-1,400 banks
46+
- All bank codes valid
47+
48+
7. **Patch Files**
49+
- IFSC patches: 20+ YAML files
50+
- Bank patches: 10+ YAML files
51+
52+
8. **Git Repository State**
53+
- Version readable from package.json
54+
- Uncommitted changes detection
55+
56+
9. **Release Decision Logic**
57+
- < 50 changes → skip
58+
- 50-500 changes → patch
59+
- > 500 changes → minor
60+
61+
10. **Export Format Validation**
62+
- JSON syntax valid
63+
- All formats parseable
64+
65+
11. **Checksum Comparison**
66+
- src/IFSC.json vs generated
67+
- Detects data changes
68+
69+
12. **Ruby Scraper Environment**
70+
- Ruby installed
71+
- Bundler available
72+
- Gemfile present
73+
74+
## Test Output
75+
76+
### Success
77+
```
78+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79+
Test Summary
80+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
81+
82+
Tests Run: 65
83+
Tests Passed: 65
84+
Tests Failed: 0
85+
86+
✓ All tests passed!
87+
88+
IFSC Release Manager skill is operational and ready.
89+
```
90+
91+
### Failure
92+
```
93+
Tests Run: 65
94+
Tests Passed: 62
95+
Tests Failed: 3
96+
97+
✗ Some tests failed.
98+
99+
Please review failures above and fix issues.
100+
```
101+
102+
## Running Specific Test Sections
103+
104+
You can comment out sections in `skill-test.sh` to run specific tests:
105+
106+
```bash
107+
# Comment out tests you don't need
108+
# TEST 1: Skill File Structure
109+
# TEST 2: Data Source Files
110+
# ... etc
111+
```
112+
113+
## When to Run Tests
114+
115+
### Regular Schedule
116+
- **Weekly**: Validate skill files are intact
117+
- **Before releases**: Ensure all components working
118+
- **After updates**: Verify changes didn't break anything
119+
120+
### Manual Triggers
121+
- After modifying sub-skills
122+
- After updating domain knowledge
123+
- When troubleshooting issues
124+
- Before creating PRs with skill changes
125+
126+
## Interpreting Results
127+
128+
### ✓ PASS (Green)
129+
Test passed successfully. Component is working as expected.
130+
131+
### ✗ FAIL (Red)
132+
Test failed. Fix the issue before proceeding.
133+
**Example:** Missing file, invalid format, incorrect count.
134+
135+
### ⚠ WARN (Yellow)
136+
Non-critical issue. Skill can work but some data may be missing.
137+
**Example:** Data files not generated (run scraper), CSV files missing.
138+
139+
### ℹ INFO (Blue)
140+
Informational message. No action needed.
141+
**Example:** Current version number, file sizes, change detected.
142+
143+
## Exit Codes
144+
145+
- **0**: All tests passed
146+
- **1**: One or more tests failed
147+
148+
Use in CI/CD:
149+
```bash
150+
if ./.claude/skills/ifsc-release-manager/tests/skill-test.sh; then
151+
echo "Tests passed, proceeding with release"
152+
else
153+
echo "Tests failed, aborting"
154+
exit 1
155+
fi
156+
```
157+
158+
## Troubleshooting
159+
160+
### "Data directory not found"
161+
**Solution:** Run the scraper first to generate data:
162+
```bash
163+
cd scraper/scripts
164+
bash bootstrap.sh
165+
```
166+
167+
### "Python dependencies missing"
168+
**Solution:** Install required packages:
169+
```bash
170+
pip install pandas openpyxl
171+
```
172+
173+
### "Ruby not installed"
174+
**Solution:** Install Ruby 3.1+:
175+
```bash
176+
# macOS
177+
brew install ruby
178+
179+
# Ubuntu
180+
sudo apt-get install ruby-full
181+
```
182+
183+
### "Bank count out of range"
184+
**Possible causes:**
185+
- NACH data outdated
186+
- Scraper parsing errors
187+
- Bank mergers/closures
188+
189+
**Solution:** Re-run NACH scraper or check NPCI website.
190+
191+
## Test Maintenance
192+
193+
Update tests when:
194+
- Adding new sub-skills
195+
- Changing file formats
196+
- Modifying expected data ranges
197+
- Adding new validation rules
198+
199+
Edit `skill-test.sh` to add new test cases.
200+
201+
## Integration with CI/CD
202+
203+
Add to GitHub Actions:
204+
```yaml
205+
- name: Test IFSC Release Manager Skill
206+
run: ./.claude/skills/ifsc-release-manager/tests/skill-test.sh
207+
```
208+
209+
Add to pre-commit hook:
210+
```bash
211+
# .git/hooks/pre-commit
212+
./.claude/skills/ifsc-release-manager/tests/skill-test.sh
213+
```
214+
215+
## Manual Test Cases
216+
217+
Beyond automated tests, manually verify:
218+
219+
1. **Skill invocation**: `claude skill ifsc-release-manager`
220+
2. **Sub-skill execution**: Test each sub-skill individually
221+
3. **Error handling**: Introduce errors, verify graceful failures
222+
4. **Release workflow**: End-to-end test with mock data
223+
224+
## Questions or Issues?
225+
226+
- Check test output for specific failures
227+
- Review sub-skill documentation
228+
- Examine domain knowledge context
229+
- Run `bash -x skill-test.sh` for debug mode

0 commit comments

Comments
 (0)