Skip to content

Commit 1c48adb

Browse files
committed
docs: enhance test running instructions for AI agents to improve failure diagnosis
1 parent 6b901a1 commit 1c48adb

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,35 @@ mvn clean package -DskipTests
3636
mvn test -Pdebug
3737
```
3838

39+
### Running Tests from AI Agents / Copilot
40+
41+
When running tests to verify changes, **always use `mvn verify` without `-q` and without piping through `grep`**. The full output is needed to diagnose failures. Do NOT use commands like:
42+
43+
```bash
44+
# BAD - hides critical failure details, often requires a second run
45+
mvn verify -q 2>&1 | grep -E 'Tests run:|BUILD'
46+
mvn verify 2>&1 | grep -E 'Tests run.*in com|BUILD|test failure'
47+
```
48+
49+
Instead, use one of these approaches:
50+
51+
```bash
52+
# GOOD - run tests with full output (preferred for investigating failures)
53+
mvn verify
54+
55+
# GOOD - run tests showing just the summary and result using Maven's built-in log level
56+
mvn verify -B --fail-at-end 2>&1 | tail -30
57+
58+
# GOOD - run a single test class when debugging a specific test
59+
mvn test -Dtest=CopilotClientTest
60+
```
61+
62+
**Interpreting results:**
63+
- `BUILD SUCCESS` at the end means all tests passed. No further investigation needed.
64+
- `BUILD FAILURE` means something failed. The lines immediately above `BUILD FAILURE` will contain the relevant error information. Look for `[ERROR]` lines near the bottom of the output.
65+
- The Surefire summary line `Tests run: X, Failures: Y, Errors: Z, Skipped: W` appears near the end and gives the counts.
66+
- **Do NOT run tests a second time** just to get different output formatting. One run with full output is sufficient.
67+
3968
## Architecture
4069

4170
### Core Components

0 commit comments

Comments
 (0)