원클릭으로
test-runner-java-gradle
a definition of tests and testing in a Java project using Gradle and JUnit 5. Advice on using Gradle to run tests.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
a definition of tests and testing in a Java project using Gradle and JUnit 5. Advice on using Gradle to run tests.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Guidelines for watching CI builds and diagnosing failures. Claude should use this skill when watching a CI build or investigating why a CI build failed.
Structural CRUD and reordering operations on plan files via the `i2code plan` CLI — insert/replace/delete/reorder threads and tasks, mark tasks/steps complete or incomplete, fix numbering, and query plan structure (get-next-task, get-thread, get-summary, list-threads). Claude MUST use this skill (not raw file edits) for any change to a plan file's threads, tasks, or steps, and for reading plan structure programmatically.
Consult the design pattern catalog before implementing or refactoring code.
When running test scripts or long-running commands that produce verbose output, redirect output to a log file under logs/ to avoid truncation in the Bash tool. Claude should use this skill when running test scripts, end-to-end tests, or any command likely to produce large output. NOTE: This skill does not apply to Gradle because test output is written to TEST*.xml files.
When stuck on a problem, formulate a well-structured question and copy it to the clipboard for pasting into ChatGPT. Claude should use this skill when debugging efforts stall or when an outside perspective would help.
Provides a pre-commit checklist and commit message formatting standards for this project. Claude should use this skill when creating git commits to ensure messages follow project conventions, including proper co-authorship attribution and concise formatting.
| name | test-runner-java-gradle |
| description | a definition of tests and testing in a Java project using Gradle and JUnit 5. Advice on using Gradle to run tests. |
This skill defines what a "test" is and how tests are executed for this Java project. It is designed to be used together with a TDD skill that determines when tests must run.
Language: Java
Test framework: JUnit 5 (Jupiter)
Detailed test output: XML files under build/test-results/<testType>/TEST-*.xml
IMPORTANT: NEVER write test scripts that use gradlew bootRun. Direct testing of Java applications done using ./gradlew test/check only.
This project uses multiple test types with separate source sets, executed in order:
| Test Type | Task | Source Directory | Purpose |
|---|---|---|---|
| Unit | ./gradlew test | src/test/java | Fast, isolated tests with mocked dependencies |
| Integration | ./gradlew integrationTest | src/integrationTest/java | Tests with real external systems (databases, message brokers) via testcontainers |
| Component | ./gradlew componentTest | src/componentTest/java | Single service tested as a Docker container |
| End-to-End | ./gradlew endToEndTest | src/endToEndTest/java | Full application with multiple services |
test → integrationTest → componentTest → endToEndTest
All test types are wired to the check task. Running ./gradlew check executes all test types in order.
A test in this project is:
@org.junit.jupiter.api.TestExamples of valid test locations:
src/test/java/com/example/MyServiceTest.java (unit test)src/integrationTest/java/com/example/MyRepositoryIntegrationTest.java (integration test)src/componentTest/java/com/example/MyServiceComponentTest.java (component test)src/endToEndTest/java/com/example/OrderWorkflowE2ETest.java (end-to-end test)JUnit 5 assertions (e.g., Assertions.assertEquals, assertThrows) should be used.
No Kotlin and no JUnit 4 are present in this project.
Tests are run incrementally, progressing from fast/isolated to slow/integrated:
TDD Loop: Run unit tests frequently during development
./gradlew test
After unit tests pass: Run integration tests
./gradlew integrationTest
After integration tests pass: Run component tests
./gradlew componentTest
Before commit/PR: Run all tests
./gradlew build
This progression provides fast feedback during development while ensuring full coverage before committing.
./gradlew test # Unit tests only
./gradlew integrationTest # Integration tests only
./gradlew componentTest # Component tests only
./gradlew endToEndTest # End-to-end tests only
./gradlew build # All test types in order
All commands must be run from the project root (the directory containing gradlew).
Do not use the --no-daemon flag with Gradle commands unless specifically troubleshooting daemon issues. The Gradle daemon improves build performance by keeping the JVM warm between builds.
Use ./gradlew build, not ./gradlew clean build. Gradle's incremental build correctly detects changes. Only use clean when:
When creating a standalone Gradle project, use the gradle wrapper command to generate wrapper files instead of copying them from another project:
cd new-project-directory
gradle wrapper --gradle-version 8.11.1
This is cleaner than copying gradle/, gradlew, and gradlew.bat files and avoids permission issues.
Do not use output filtering with Gradle commands (no | tail, | head, or 2>&1 redirection). Gradle's console output is already concise - just task names and pass/fail status. Verbose test output (Hibernate SQL, Spring Boot logs, etc.) is captured in TEST-*.xml files, not streamed to the console.
./gradlew check to verify changes - this runs all test types (unit, integration, component tests)./gradlew test only when specifically running unit tests in a TDD loop./gradlew test only runs unit tests and misses integration/component testsFor any code modification task (refactoring, bug fixes, new features):
./gradlew build passes (includes all tests)When performing refactoring tasks (renaming classes, methods, moving files, changing signatures), always run the full test suite (./gradlew check) without excluding any test categories. Refactoring can break:
Only exclude test categories when explicitly instructed by the user or when debugging a specific test failure.
Exit code meaning:
The console output of Gradle indicates only overall success or failure, not individual test results.
When ./gradlew build succeeds (BUILD SUCCESSFUL), that is authoritative proof that all tests passed. Do not:
TEST*.xml and HTML reports are for human debugging, not for Claude verification.
Detailed per-test results are located in test-type-specific directories:
build/test-results/test/TEST-*.xml # Unit tests
build/test-results/integrationTest/TEST-*.xml # Integration tests
build/test-results/componentTest/TEST-*.xml # Component tests
build/test-results/endToEndTest/TEST-*.xml # End-to-end tests
Each XML file corresponds to a test class and contains:
<testsuite> metadata such as total tests and failures<testcase classname="..." name="..."> elements<failure> elements that contain the failure message and stack trace snippetThe agent must extract:
This information must be used to explain why tests failed and guide the next RED → GREEN change.
The TDD skill uses an Evidence block with fields:
tests: pass | fail | not-runlast_output: <text>This Test Runner skill defines how to populate those fields.
When tests pass:
tests: passlast_output should mention that ./gradlew test exited with code 0When tests fail:
tests: faillast_output should mention that ./gradlew test exited with a non-zero codebuild/test-results/test/) and describe the failing test(s)When tests cannot run (environment error):
tests: not-runlast_output should say that Gradle could not be executed./gradlew checkbuild/test-results/<testType> to identify failing testsNEVER delete or remove tests to make a build pass. If tests fail:
Deleting tests hides broken functionality and is never an acceptable solution.
NEVER ignore test failures. When tests fail:
When a test fails (whether from pre-commit hook, CI, or manual run):
Never assume a fix is correct without running the test to verify.
@Test methods in Java only./gradlew test (unit tests only)./gradlew check (all test types)build/test-results/<testType>/TEST-*.xml