bdd-test-runner
Skill67 starsChanged 46 days agoApache-2.0View on GitHub
Runs BDD-compliant GIVEN-WHEN-THEN tests, validates naming compliance, and analyzes coverage. Use when running tests, checking BDD compliance, validating test patterns, or verifying that test names follow GIVEN-WHEN-THEN conventions. Make sure to use this skill whenever tests need to be executed — it validates naming compliance and catches convention violations that plain test runners miss.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- codegenSkill
- commitSkill
- compilationSkill
- feature-optionSkill
- issue-creatorSkill
- kotlin-api-consultantSkill
- prSkill
- sample-scaffolderSkill
- skill-creatorSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 74
Test logic errors → fix test or implementation
- Distinctive: line 111
If coverage gaps → offer to write GIVEN-WHEN-THEN tests for them
- Distinctive: line 112
If failures → suggest fixes or relevant skills
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
BDD Test Runner & Compliance Validator
Executes GIVEN-WHEN-THEN tests with compliance validation and coverage analysis.
Instructions
1. Understand Test Request
Common requests:
- "Run all tests" →
./gradlew test - "Run compiler tests" →
./gradlew :compiler:test - "Run specific tests" →
./gradlew :compiler:test --tests "*Pattern*" - "Validate test naming" → BDD compliance check only
- "Check coverage" → Coverage analysis
2. Pre-Execution BDD Compliance Check
Unit tests live in compiler/, codegen-runtime/, gradle-plugin/, compiler-api/ and build-logic/ (src/test/kotlin); sample tests live under samples/*/src/*Test/.
TEST_DIRS="compiler/src/test codegen-runtime/src/test gradle-plugin/src/test compiler-api/src/test build-logic/src/test"
# Count GIVEN-WHEN-THEN tests
grep -rh "fun \`GIVEN" $TEST_DIRS | wc -l
# Forbidden "should" naming — expect zero matches
grep -rn "fun \`should" $TEST_DIRSCompliance checklist:
- All test methods use GIVEN-WHEN-THEN naming (uppercase)
- No "should" pattern (forbidden)
- All classes have
@TestInstance(TestInstance.Lifecycle.PER_CLASS) - Vanilla assertions only (no custom matchers)
- No mocks (use fakes)
If violations found — report and do not proceed until acknowledged:
BDD COMPLIANCE VIOLATION
Found {count} tests using "should" pattern (forbidden)
Files: {list}
Reference: .claude/docs/development/validation/testing-guidelines.md3. Execute Tests
# All tests (from the repository root)
./gradlew test
# One module (:compiler, :codegen-runtime, :gradle-plugin, :compiler-api)
./gradlew :codegen-runtime:test
# Pattern-based
./gradlew :compiler:test --tests "*{Pattern}*"
# Samples (built against the published plugin)
make publish-local && make test-sample4. Analyze Results
Parse output: total run, passed, failed, skipped, execution time.
If failures: categorize each failure and suggest relevant skills:
- Compilation errors →
compilationskill - Test logic errors → fix test or implementation
- Missing imports → check generated code
5. Coverage Analysis
List source files with no matching *Test.kt in the module you changed (a heuristic — some classes are covered through other tests):
MODULE=codegen-runtime # or compiler, gradle-plugin, compiler-api
find $MODULE/src/main/kotlin -name "*.kt" | while read file; do
testFile="${file/src\/main/src\/test}"
testFile="${testFile/.kt/Test.kt}"
if [ ! -f "$testFile" ]; then
echo "Missing tests for: $file"
fi
done6. Report
BDD TEST EXECUTION REPORT
Compliance: {PASSED/FAILED}
- GIVEN-WHEN-THEN naming: {count}/{total} ✅
- "should" violations: {count}
Execution:
- Total: {n} | Passed: {n} | Failed: {n} | Skipped: {n}
- Time: {duration}
Coverage:
- Implementation files: {n} | Test files: {n}
- Coverage gaps: {list if any}Follow-up suggestions:
- If coverage gaps → offer to write GIVEN-WHEN-THEN tests for them
- If failures → suggest fixes or relevant skills
Related Skills
compilation— Validate code compiles
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

