-
-
Save ianlandsman/303ed772784432e33b65c606c3b5a799 to your computer and use it in GitHub Desktop.
Ralph for tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <iterations>" | |
| exit 1 | |
| fi | |
| for ((i=1; i<=$1; i++)); do | |
| echo "Iteration $i" | |
| result=$(claude -p "@test-coverage-progress.txt \ | |
| WHAT MAKES A GREAT TEST: \ | |
| A great test covers behavior users depend on. It tests a feature that, if broken, would frustrate or block users. \ | |
| It validates real workflows - not implementation details. It catches regressions before users do. \ | |
| Do NOT write tests just to increase coverage. Use coverage as a guide to find UNTESTED USER-FACING BEHAVIOR. \ | |
| If uncovered code is not worth testing (boilerplate, unreachable error branches, internal plumbing), \ | |
| add @codeCoverageIgnoreStart and @codeCoverageIgnoreEnd annotations instead of writing low-value tests. \ | |
| \ | |
| PROCESS: \ | |
| 1. Run herd coverage ./vendor/bin/pest --coverage --parallel to see which files have low coverage. \ | |
| 2. Read the uncovered lines and identify the most important USER-FACING FEATURE that lacks tests. \ | |
| Prioritize: error handling users will hit, controller actions, form requests, service methods, Artisan commands, API endpoints. \ | |
| Deprioritize: internal utilities, edge cases users won't encounter, framework boilerplate. \ | |
| 3. Write ONE meaningful Pest test that validates the feature works correctly for users. \ | |
| 4. Run herd coverage ./vendor/bin/pest --coverage --parallel again - coverage should increase as a side effect of testing real behavior. \ | |
| 5. Commit with message: test(<file>): <describe the user behavior being tested> \ | |
| 6. Append super-concise notes to test-coverage-progress.txt: what you tested, coverage %, any learnings. \ | |
| \ | |
| ONLY WRITE ONE TEST PER ITERATION. \ | |
| If statement coverage reaches 100%, output <promise>COMPLETE</promise>. \ | |
| ") | |
| echo "$result" | |
| if [[ "$result" == *"<promise>COMPLETE</promise>"* ]]; then | |
| echo "100% coverage reached, exiting." | |
| tt notify "Done: 100% coverage after $i iterations" | |
| exit 0 | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment