Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 18, 2025

Explicit tests marked with [Explicit] attribute were not being discovered by IDEs like Rider, making them invisible in test explorers and missing the green triangle indicators next to test methods. The issue occurred because the test discovery pipeline was filtering out explicit tests during the discovery phase.

Root Cause:
The TestDiscoveryService.DiscoverTests() method was applying _testFilterService.FilterTests() during discovery, which removed explicit tests from the results sent to IDEs. IDEs need to see ALL tests (including explicit ones) during discovery to display them in test explorers.

Solution:
Separated discovery behavior from execution filtering by:

  1. Adding an isForExecution parameter to TestDiscoveryService.DiscoverTests()
  2. For discovery requests (isForExecution: false): Return all tests including explicit ones
  3. For execution requests (isForExecution: true): Apply normal filtering to exclude explicit tests unless explicitly targeted

Changes:

  • TestDiscoveryService.cs: Added overload with isForExecution parameter to control filtering behavior
  • TestRequestHandler.cs: Updated discovery requests to use isForExecution: false and run requests to use isForExecution: true

Result:

  • ✅ Explicit tests are now discovered by IDEs and visible in test explorers
  • ✅ Green triangle indicators appear next to explicit test methods
  • ✅ Explicit tests still only execute when explicitly targeted (existing behavior preserved)
  • ✅ Regular wildcard filters still exclude explicit tests from execution

The fix is minimal and surgical, maintaining backward compatibility while restoring the expected IDE experience.

Fixes #2946.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ering

Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Explicit Tests are not Discovered Fix explicit tests not being discovered by IDEs Aug 18, 2025
@Copilot Copilot AI requested a review from thomhurst August 18, 2025 11:38
Copilot finished work on behalf of thomhurst August 18, 2025 11:38
@thomhurst thomhurst marked this pull request as ready for review August 18, 2025 12:18
@Copilot Copilot AI temporarily deployed to Pull Requests August 18, 2025 12:18 Inactive
@Copilot Copilot AI temporarily deployed to Pull Requests August 18, 2025 12:18 Inactive
@Copilot Copilot AI temporarily deployed to Pull Requests August 18, 2025 12:18 Inactive
@Copilot Copilot AI temporarily deployed to Pull Requests August 18, 2025 12:18 Inactive
@Copilot Copilot AI temporarily deployed to Pull Requests August 18, 2025 12:18 Inactive
@Copilot Copilot AI temporarily deployed to Pull Requests August 18, 2025 12:18 Inactive
@thomhurst thomhurst enabled auto-merge (squash) August 18, 2025 12:18
@thomhurst thomhurst merged commit 4689440 into main Aug 18, 2025
13 of 15 checks passed
@thomhurst thomhurst deleted the copilot/fix-2946 branch August 18, 2025 12:43
This was referenced Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explicit Tests are not Discovered
2 participants