Skip to content

Commit 3827a0c

Browse files
committed
Add test coverage assessment prompt
1 parent 03f0f60 commit 3827a0c

1 file changed

Lines changed: 125 additions & 0 deletions

File tree

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Test Coverage Assessment
2+
3+
You are an expert Java developer tasked with analyzing test coverage for this Java SDK. Your goal is to produce a comprehensive report of what is tested and what gaps exist.
4+
5+
## Objective
6+
7+
Analyze the test coverage of the SDK by examining:
8+
1. **Event types** - All session events defined in `SessionEventParser`
9+
2. **Hook types** - All hooks defined in `SessionHooks`
10+
3. **Core functionality** - Session management, tools, permissions, etc.
11+
12+
## Assessment Process
13+
14+
### Step 1: Identify All Testable Components
15+
16+
First, examine the source code to identify all components that should be tested:
17+
18+
```bash
19+
# List all event classes
20+
ls src/main/java/com/github/copilot/sdk/events/
21+
22+
# Check the event type mapping in SessionEventParser
23+
grep -A 50 "TYPE_MAP.put" src/main/java/com/github/copilot/sdk/events/SessionEventParser.java
24+
```
25+
26+
Extract the list of all registered event types from `SessionEventParser.java`.
27+
28+
### Step 2: Identify All Hook Types
29+
30+
Check `SessionHooks.java` for all available hook handlers:
31+
32+
```bash
33+
grep -E "private.*Handler" src/main/java/com/github/copilot/sdk/json/SessionHooks.java
34+
```
35+
36+
### Step 3: Analyze Existing Tests
37+
38+
Examine the test files to understand current coverage:
39+
40+
```bash
41+
# List all test files
42+
ls src/test/java/com/github/copilot/sdk/
43+
44+
# Check for event-related tests
45+
grep -r "import.*events\." src/test/java/com/github/copilot/sdk/ | grep -v "\.class"
46+
47+
# Check for hook tests
48+
grep -l "SessionHooks\|Hook" src/test/java/com/github/copilot/sdk/*.java
49+
```
50+
51+
### Step 4: Categorize Test Coverage
52+
53+
For each component, determine:
54+
- **Unit Test Coverage**: Tests that verify JSON parsing/serialization without E2E flow
55+
- **E2E Test Coverage**: Tests that verify the component works in a real session flow
56+
57+
## Report Format
58+
59+
Generate a comprehensive report in the following format:
60+
61+
### Event Types Coverage
62+
63+
| Event Type | Event Class | Unit Test | E2E Test | Notes |
64+
|------------|-------------|:---------:|:--------:|-------|
65+
| `session.start` | `SessionStartEvent` | ✅/❌ | ✅/❌ | Any notes |
66+
| ... | ... | ... | ... | ... |
67+
68+
### Hook Types Coverage
69+
70+
| Hook Type | Handler Interface | Unit Test | E2E Test | Notes |
71+
|-----------|-------------------|:---------:|:--------:|-------|
72+
| `preToolUse` | `PreToolUseHandler` | ✅/❌ | ✅/❌ | Any notes |
73+
| ... | ... | ... | ... | ... |
74+
75+
### Coverage Summary
76+
77+
| Category | Total | Unit Tested | E2E Tested | Coverage % |
78+
|----------|-------|-------------|------------|------------|
79+
| Events | X | X | X | X% |
80+
| Hooks | X | X | X | X% |
81+
82+
### Gaps Identified
83+
84+
List components that lack tests:
85+
1. **Missing Unit Tests**: Components without JSON parsing tests
86+
2. **Missing E2E Tests**: Components not exercised in integration tests
87+
3. **Partially Tested**: Components with incomplete test coverage
88+
89+
### Recommendations
90+
91+
Prioritized list of tests to add:
92+
1. High priority: Critical paths without coverage
93+
2. Medium priority: Common use cases without coverage
94+
3. Low priority: Edge cases and rare events
95+
96+
## Key Files to Examine
97+
98+
- `src/main/java/com/github/copilot/sdk/events/SessionEventParser.java` - Event type registry
99+
- `src/main/java/com/github/copilot/sdk/json/SessionHooks.java` - Hook definitions
100+
- `src/main/java/com/github/copilot/sdk/CopilotSession.java` - Hook handling logic
101+
- `src/test/java/com/github/copilot/sdk/SessionEventParserTest.java` - Event parsing tests
102+
- `src/test/java/com/github/copilot/sdk/SessionEventsE2ETest.java` - Event E2E tests
103+
- `src/test/java/com/github/copilot/sdk/HooksTest.java` - Hook tests
104+
- `src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java` - Event handling tests
105+
106+
## Verification
107+
108+
After producing the report, verify by running:
109+
110+
```bash
111+
# Count total tests
112+
mvn test 2>&1 | grep "Tests run:"
113+
114+
# Run specific test categories
115+
mvn test -Dtest=SessionEventParserTest
116+
mvn test -Dtest=SessionEventsE2ETest
117+
mvn test -Dtest=HooksTest
118+
```
119+
120+
## Output
121+
122+
Provide:
123+
1. The complete coverage report in markdown table format
124+
2. A prioritized list of recommended improvements
125+
3. Optionally: Skeleton test code for missing high-priority tests

0 commit comments

Comments
 (0)