-
-
Notifications
You must be signed in to change notification settings - Fork 467
Add a /test skill to run singular tests or per module tests #5111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| name: test | ||
| description: Run tests for a specific SDK module. Use when asked to "run tests", "test module", "run unit tests", "run system tests", "run e2e tests", or test a specific class. Auto-detects unit vs system tests. Supports interactive mode. | ||
| allowed-tools: Bash, Read, Glob | ||
| argument-hint: [interactive] <module-name-or-file-path> [test-class-filter] | ||
| --- | ||
|
|
||
| # Run Tests | ||
|
|
||
| Run tests for a specific module. Auto-detects whether to run unit tests or system tests. | ||
|
|
||
| ## Step 0: Check for Interactive Mode | ||
|
|
||
| If `$ARGUMENTS` starts with `interactive` (e.g., `/test interactive sentry ScopesTest`), enable interactive mode. Strip the `interactive` keyword from the arguments before proceeding. | ||
|
|
||
| In interactive mode, use AskUserQuestion at decision points as described in the steps below. | ||
|
|
||
| ## Step 1: Parse the Argument | ||
|
|
||
| The argument can be either: | ||
| - A **file path** (e.g., `@sentry/src/test/java/io/sentry/ScopesTest.kt`) | ||
| - A **module name** (e.g., `sentry-android-core`, `sentry-samples-spring-boot-4`) | ||
| - A **module name + test filter** (e.g., `sentry ScopesTest`) | ||
|
|
||
| Extract the module name and optional test class filter from the argument. | ||
|
|
||
| **Interactive mode:** If the test filter is ambiguous (e.g., matches multiple test classes across modules), use AskUserQuestion to let the user pick which test class(es) to run. | ||
|
|
||
| ## Step 2: Detect Test Type | ||
|
|
||
| | Signal | Test Type | | ||
| |--------|-----------| | ||
| | Path contains `sentry-samples/` | System test | | ||
| | Module name starts with `sentry-samples-` | System test | | ||
| | Everything else | Unit test | | ||
|
|
||
| ## Step 3a: Run Unit Tests | ||
|
|
||
| Determine the Gradle test task: | ||
|
|
||
| | Module Pattern | Test Task | | ||
| |---------------|-----------| | ||
| | `sentry-android-*` | `testDebugUnitTest` | | ||
| | `sentry-compose*` | `testDebugUnitTest` | | ||
| | Everything else | `test` | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test task detection misses Android module naming patternMedium Severity The module-to-test-task mapping only handles |
||
|
|
||
| **Interactive mode:** Before running, read the test class file and use AskUserQuestion to ask: | ||
| - "Run all tests in this class, or a specific method?" — list the test method names as options. | ||
|
|
||
| If the user picks a specific method, use `--tests="*ClassName.methodName"` as the filter. | ||
|
|
||
| With a test class filter: | ||
| ```bash | ||
| ./gradlew ':<module>:<task>' --tests="*<filter>*" --info | ||
| ``` | ||
|
|
||
| Without a filter: | ||
| ```bash | ||
| ./gradlew ':<module>:<task>' --info | ||
| ``` | ||
|
|
||
| ## Step 3b: Run System Tests | ||
|
|
||
| System tests require the Python-based test runner which manages a mock Sentry server and sample app lifecycle. | ||
|
|
||
| 1. Ensure the Python venv exists: | ||
| ```bash | ||
| test -d .venv || make setupPython | ||
| ``` | ||
|
|
||
| 2. Extract the sample module name. For file paths like `sentry-samples/<sample-module>/src/...`, the sample module is the directory name (e.g., `sentry-samples-spring`). | ||
|
|
||
| 3. Run the system test: | ||
| ```bash | ||
| .venv/bin/python test/system-test-runner.py test --module <sample-module> | ||
| ``` | ||
|
|
||
| This starts the mock Sentry server, starts the sample app (Spring Boot/Tomcat/CLI), runs tests via `./gradlew :sentry-samples:<sample-module>:systemTest`, and cleans up afterwards. | ||
|
|
||
| ## Step 4: Report Results | ||
|
|
||
| Summarize the test outcome: | ||
| - Total tests run, passed, failed, skipped | ||
| - For failures: show the failing test name and the assertion/error message | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interactive mode tool not listed in allowed-tools
Medium Severity
The skill's interactive mode (Steps 0, 1, and 3a) instructs Claude to use
AskUserQuestionat multiple decision points, butallowed-toolsonly listsBash, Read, Glob. SinceAskUserQuestionis a distinct Claude Code tool that can be included inallowed-tools, its omission means the interactive mode feature described throughout the skill cannot function as intended when tool restrictions are enforced.Additional Locations (1)
.claude/skills/test/SKILL.md#L13-L15