You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/prompts/minimize-test-overlap.prompt.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,19 @@ Your task is to analyze the user's test suite using the `AnalyzeTestOverlap.ps1`
10
10
11
11
## Skills
12
12
This prompt leverages the following skills for specific sub-tasks:
13
-
-[generate-mstest-filter](.github/skills/generate-mstest-filter/SKILL.md) - For generating well-formed MSTest filter expressions
13
+
-[generate-mstest-filter](../skills/generate-mstest-filter/SKILL.md) - For generating well-formed MSTest filter expressions
14
14
15
15
## Tools
16
-
You have access to the analysis script at `[AnalyzeTestOverlap.ps1](.\prompts\scripts\AnalyzeTestOverlap.ps1)`.
16
+
You have access to the analysis script at `[AnalyzeTestOverlap.ps1](./scripts/AnalyzeTestOverlap.ps1)`.
17
17
18
18
## Workflow
19
19
1.**Parse or Generate Test Filter**:
20
20
* If `${input:filter}` is a valid MSTest filter expression (e.g., `FullyQualifiedName~MyTests`), use it directly.
21
-
* If `${input:filter}` is a loose description (e.g., "connection tests" or "SqlCommand class"), follow the instructions in the [generate-mstest-filter](.github/skills/generate-mstest-filter/SKILL.md) skill to generate a proper filter expression.
21
+
* If `${input:filter}` is a loose description (e.g., "connection tests" or "SqlCommand class"), follow the instructions in the [generate-mstest-filter](../skills/generate-mstest-filter/SKILL.md) skill to generate a proper filter expression.
22
22
* If `${input:filter}` is empty, ask the user for a test filter or description to target specific tests.
23
23
24
24
2.**Run Analysis**:
25
-
* Run the script using the filter: `.\prompts\scripts\AnalyzeTestOverlap.ps1 -Filter "<filter>"`.
25
+
* Run the script using the filter: `.\scripts\AnalyzeTestOverlap.ps1 -Filter "<filter>"`.
26
26
**Note*: The script produces a console summary and a `test-coverage-analysis.json` file.
> **Important**: For xUnit tests (common in .NET Core projects), **always use `FullyQualifiedName` or `DisplayName`**. The `Name` and `ClassName` properties are not populated by xUnit and will result in no matches.
27
30
28
31
### Operators
29
32
@@ -38,41 +41,47 @@ This skill generates MSTest filter expressions for use with `dotnet test --filte
- If the user's description is ambiguous, ask for clarification about:
155
201
- Whether they want exact match or contains
156
202
- The full class name or namespace if needed
157
203
- Whether conditions should be AND or OR
158
204
159
-
- If ClassName filter doesn't work, remind the user that `ClassName` must include the namespace (e.g., `Namespace.ClassName`, not just `ClassName`)
205
+
-**If a filter returns no matches**:
206
+
- First, verify the test class/method exists in the project
207
+
- Switch to `FullyQualifiedName~` with contains operator
208
+
- Check if the project uses xUnit (common in .NET Core) - if so, avoid `Name` and `ClassName` properties
160
209
161
210
- For complex filters, validate that parentheses are balanced
162
211
@@ -171,5 +220,14 @@ dotnet test --filter "FullyQualifiedName!~Integration&FullyQualifiedName!~Perfor
171
220
172
221
- For project-specific tests, add the project path:
173
222
```bash
174
-
dotnet test path/to/project.csproj --filter "Name~MyTest"
223
+
dotnet test path/to/project.csproj --filter "FullyQualifiedName~MyTest"
175
224
```
225
+
226
+
## Common Pitfalls
227
+
228
+
| Problem | Cause | Solution |
229
+
|---------|-------|----------|
230
+
| No test matches filter | Using `Name=` or `ClassName=` with xUnit | Use `FullyQualifiedName~` instead |
231
+
| No test matches filter | Using just class name without namespace in `ClassName=`| Use `FullyQualifiedName~ClassName`|
232
+
| Filter matches too many tests | Using overly broad `~` pattern | Add more specific qualifiers or use `&` with additional conditions |
233
+
| TestCategory filter doesn't work | Project uses xUnit, which doesn't support TestCategory | Use `[Trait]` attributes with xUnit and filter by trait name |
0 commit comments