test
Run unit and UI tests for GridRacer
SKILL.md.claude/skills/test
GitHubRun GridRacer Tests
Execute unit tests and optionally UI tests.
Steps
Auto-detect simulator:
SIMULATOR=$(xcrun simctl list devices available | grep -E "iPhone (16|15|14)" | grep -v unavailable | head -1 | sed -E 's/.*iPhone ([0-9]+).*/iPhone \1/')Run unit tests:
xcodebuild test -scheme GridRacer -destination "platform=iOS Simulator,name=$SIMULATOR" -only-testing:GridRacerTests 2>&1 > /tmp/test_output.logParse and report results:
Count results:
PASSED=$(grep -c "passed on" /tmp/test_output.log || echo "0") FAILED=$(grep -c "failed on" /tmp/test_output.log || echo "0") TOTAL=$((PASSED + FAILED))If all passed:
Test Results: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Passed: <PASSED> tests ❌ Failed: 0 tests Test Suites: ✅ GridPointTests (4/4) ✅ GridVectorTests (5/5) ✅ MovementCalculatorTests (5/5) ✅ BresenhamPathTests (7/7) ✅ TrackTests (6/6) ✅ PlayerTests (6/6) ✅ GameStateTests (6/6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Status: READY TO COMMIT ✓If failures:
Test Results: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Passed: <PASSED> tests ❌ Failed: <FAILED> tests Failed Tests:Then show failed test names:
grep "failed on" /tmp/test_output.log | sed -E "s/.*Test case '([^']+)'.*/ - \1/" | head -10━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Status: FIX TESTS BEFORE COMMITTING ❌Optionally run UI tests if requested:
xcodebuild test -scheme GridRacer -destination "platform=iOS Simulator,name=$SIMULATOR" -only-testing:GridRacerUITests 2>&1 | grep -E "(Test Case|passed|failed|error:|SUCCEEDED|FAILED)" | tail -30
Output Format
The skill should always produce formatted, easy-to-read output with:
- Clear pass/fail counts
- Test suite breakdown (when possible)
- Specific failed test names
- Clear status indicator for commit readiness