Add exp-mock-usage-analysis skill and evaluation - #483
Conversation
New experimental skill that detects unused, redundant, or unnecessary mocks in .NET test suites. Covers Moq, NSubstitute, FakeItEasy, and manual test doubles. - SKILL.md with 6-step workflow: gather code, classify mocks, detect anti-patterns, incorporate runtime data, generate recommendations, report findings - eval.yaml with 10 scenarios: trivial type mocking, unused setups, redundant configs, stable utility mocks, well-placed mocks (no false positives), NSubstitute support, FakeItEasy support, setup sprawl, and 2 non-activation boundary tests - Fixture files for each scenario with production + test code - CODEOWNERS entry for @dotnet/dotnet-testing
# Conflicts: # .github/CODEOWNERS
|
/evaluate |
Skill Validation Results
[1] (Plugin) Quality unchanged but weighted score is -11.5% due to: tokens (27055 → 58677), quality, time (25.6s → 61.0s), tool calls (4 → 6)
Model: claude-opus-4.6 | Judge: claude-opus-4.6
🔍 Full Results - additional metrics and failure investigation steps |
Remove 4 scenarios where baseline already scores 5.0/5 (model handles these well without skill guidance): - Detect mocking of DTOs, records, and enums - Recognize well-placed mocks without inventing false positives - Decline when asked about non-mock test anti-patterns - Decline mock framework migration request Increase NSubstitute scenario timeout from 120s to 180s to avoid baseline timeouts impacting scoring. Remaining 6 scenarios all show positive skill impact (3→5, 3→4, etc).
Add a subsection under 'When Not to Use' listing mock-related tasks where the base model already scores 5.0/5 without skill guidance: - Mocking trivial types (DTOs, records, enums) - Recognizing well-placed mocks (no false positives)
|
/evaluate |
|
❌ Evaluation failed. View workflow run |
|
/evaluate |
Skill Validation Results
Model: claude-opus-4.6 | Judge: claude-opus-4.6
🔍 Full Results - additional metrics and failure investigation steps |
# Conflicts: # .github/CODEOWNERS
|
/evaluate |
Skill Validation Results
[1] Model: claude-opus-4.6 | Judge: claude-opus-4.6 🔍 Full Results - additional metrics and failure investigation steps |
There was a problem hiding this comment.
Pull request overview
Adds a new experimental .NET test mock usage analysis skill to the dotnet-experimental plugin, along with an evaluation suite and scenario fixtures to measure detection of unused/unreachable/redundant mock configuration across common mocking frameworks.
Changes:
- Added
exp-mock-usage-analysisskill definition (workflow + framework terminology guidance). - Added evaluation scenarios (
eval.yaml) and fixture source files for Moq/NSubstitute/FakeItEasy mock-usage patterns. - Added design notes and CODEOWNERS entries for the new skill/tests.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/dotnet-experimental/exp-mock-usage-analysis/well-placed-mocks/AppointmentSchedulerTests.cs | Fixture tests demonstrating “well-placed mocks” patterns. |
| tests/dotnet-experimental/exp-mock-usage-analysis/well-placed-mocks/AppointmentScheduler.cs | Fixture production code for “well-placed mocks” tests. |
| tests/dotnet-experimental/exp-mock-usage-analysis/unused-setups/InventoryServiceTests.cs | Moq fixture tests with intentionally unused/unreachable setups. |
| tests/dotnet-experimental/exp-mock-usage-analysis/unused-setups/InventoryService.cs | Fixture production code to support unused/unreachable setup tracing. |
| tests/dotnet-experimental/exp-mock-usage-analysis/stable-utility-mocks/AuthenticationServiceTests.cs | Fixture tests demonstrating mocking ILogger/IOptions patterns. |
| tests/dotnet-experimental/exp-mock-usage-analysis/stable-utility-mocks/AuthenticationService.cs | Fixture production code for stable-utility mocking scenarios. |
| tests/dotnet-experimental/exp-mock-usage-analysis/setup-sprawl/ReportGeneratorTests.cs | Fixture tests with heavy mock setup sprawl/duplication. |
| tests/dotnet-experimental/exp-mock-usage-analysis/setup-sprawl/ReportGenerator.cs | Fixture production code to reveal unused setups and dependency sprawl. |
| tests/dotnet-experimental/exp-mock-usage-analysis/redundant-mocks/BillingServiceTests.cs | Fixture tests with redundant mock boilerplate and interaction-only assertions. |
| tests/dotnet-experimental/exp-mock-usage-analysis/redundant-mocks/BillingService.cs | Fixture production code to support redundant/unreachable setup analysis. |
| tests/dotnet-experimental/exp-mock-usage-analysis/nsubstitute-mocks/ShippingServiceTests.cs | NSubstitute fixture tests including unused/unreachable setups and interaction-only checks. |
| tests/dotnet-experimental/exp-mock-usage-analysis/nsubstitute-mocks/ShippingService.cs | Fixture production code for NSubstitute scenarios. |
| tests/dotnet-experimental/exp-mock-usage-analysis/mocking-trivial-types/OrderServiceTests.cs | Fixture tests demonstrating over-mocking trivial/value types. |
| tests/dotnet-experimental/exp-mock-usage-analysis/mocking-trivial-types/OrderService.cs | Fixture production code for trivial-type mocking examples. |
| tests/dotnet-experimental/exp-mock-usage-analysis/mocking-trivial-types/Models.cs | Fixture DTO/value-object models used by trivial-type mocking examples. |
| tests/dotnet-experimental/exp-mock-usage-analysis/fakeiteasy-mocks/NotificationDispatcherTests.cs | FakeItEasy fixture tests with intentionally unnecessary A.CallTo setups. |
| tests/dotnet-experimental/exp-mock-usage-analysis/fakeiteasy-mocks/NotificationDispatcher.cs | Fixture production code for FakeItEasy scenarios. |
| tests/dotnet-experimental/exp-mock-usage-analysis/eval.yaml | Evaluation scenarios driving the skill-validator runs for this skill. |
| plugins/dotnet-experimental/skills/exp-mock-usage-analysis/SKILL.md | Skill instructions emphasizing code-path tracing and framework-accurate terminology. |
| docs/dotnet-experimental/exp-mock-usage-analysis-design-notes.md | Design notes documenting iteration history and eval outcomes. |
| .github/CODEOWNERS | Adds ownership for the new skill + tests under @dotnet/dotnet-testing. |
Comments suppressed due to low confidence (1)
tests/dotnet-experimental/exp-mock-usage-analysis/eval.yaml:15
- The scenario header comments are inconsistently numbered (e.g., Scenario 1, then Scenario 3, then Scenario 4 twice, then Scenario 7/8). This is confusing when maintaining/triaging eval results; renumber the headers to match the actual ordering or remove the numeric labels and rely on the
name:fields.
# ============================================================
# Scenario 1: Unused mock setups
# ============================================================
- name: "Detect unused and unreachable mock setups"
prompt: |
I've been told our tests have a lot of dead mock setup code — setups for
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/evaluate |
Skill Validation Results
[1] Model: claude-opus-4.6 | Judge: claude-opus-4.6 🔍 Full Results - additional metrics and failure investigation steps |
* Add exp-mock-usage-analysis skill and evaluation New experimental skill that detects unused, redundant, or unnecessary mocks in .NET test suites. Covers Moq, NSubstitute, FakeItEasy, and manual test doubles. - SKILL.md with 6-step workflow: gather code, classify mocks, detect anti-patterns, incorporate runtime data, generate recommendations, report findings - eval.yaml with 10 scenarios: trivial type mocking, unused setups, redundant configs, stable utility mocks, well-placed mocks (no false positives), NSubstitute support, FakeItEasy support, setup sprawl, and 2 non-activation boundary tests - Fixture files for each scenario with production + test code - CODEOWNERS entry for @dotnet/dotnet-testing * Remove no-headroom scenarios, increase NSubstitute timeout Remove 4 scenarios where baseline already scores 5.0/5 (model handles these well without skill guidance): - Detect mocking of DTOs, records, and enums - Recognize well-placed mocks without inventing false positives - Decline when asked about non-mock test anti-patterns - Decline mock framework migration request Increase NSubstitute scenario timeout from 120s to 180s to avoid baseline timeouts impacting scoring. Remaining 6 scenarios all show positive skill impact (3→5, 3→4, etc). * Document areas the model handles well without the skill Add a subsection under 'When Not to Use' listing mock-related tasks where the base model already scores 5.0/5 without skill guidance: - Mocking trivial types (DTOs, records, enums) - Recognizing well-placed mocks (no false positives) * Fix md * Improve
New experimental skill that detects unused, redundant, or unnecessary mocks in .NET test suites. Covers Moq, NSubstitute, FakeItEasy, and manual test doubles.