Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

Fix test matching when referenced with and without file filters

Related Issue

Fixes #78

When a test is referenced in multiple requirements—some with file filters (filepart@testname) and some without—the plain name reference fails to match if the filtered reference matches first.

Changes

  • Modified TraceMatrix.FindAllMatchingTestNames(): Removed early-exit logic that prevented matching plain test names when source-specific names matched. Now iterates through all required tests and matches both formats.

  • Added regression test: TraceMatrix_WithMixedFilterAndPlainReferences_MatchesBoth validates that a single test result satisfies both filtered and unfiltered requirement references.

  • Added requirement TEST-010: Linked the new test to requirements.yaml to document the expected behavior that a test can satisfy multiple requirements when referenced with and without file filters.

Example

requirements:
  - id: "REQ-001"
    title: "Windows-specific requirement"
    tests:
      - "windows@Test_SharedTest"  # Matches only windows test files
  
  - id: "REQ-002"
    title: "General requirement"
    tests:
      - "Test_SharedTest"  # Should match all test files, including windows

Previously, when test-results-windows-latest.trx containing Test_SharedTest was processed, only REQ-001 was satisfied. Now both requirements are correctly satisfied.

Original prompt

I'm seeing reports that if a test is referenced in multiple requirements - some with a file-filter and some without any file-filter then the test may not be detected. Please make sure that situation is tested and fix if it doesn't work.


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

- Add regression test TraceMatrix_WithMixedFilterAndPlainReferences_MatchesBoth
- Fix FindAllMatchingTestNames to match both source-specific AND plain test names
- Test now correctly handles scenario where test is referenced with and without file-filter

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test detection for multiple requirements with file-filter Fix test matching when referenced with and without file filters Jan 13, 2026
Copilot AI requested a review from Malcolmnixon January 13, 2026 05:18
@Malcolmnixon
Copy link
Contributor

This PR fixes issue #78

@Malcolmnixon
Copy link
Contributor

@copilot Should the new test be linked to any requirements in the requirements.yaml file?

Link the new test TraceMatrix_WithMixedFilterAndPlainReferences_MatchesBoth to requirement TEST-010, which validates that a test can satisfy multiple requirements when referenced with and without file filters.

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Should the new test be linked to any requirements in the requirements.yaml file?

Yes, I've added requirement TEST-010 to link the new test. The requirement validates that a test can satisfy multiple requirements when referenced with and without file filters. Commit: d6e785d

@Malcolmnixon
Copy link
Contributor

@copilot Quality checks broken again - please run all quality checks - the following is one that got broken but there may be more:
Error: requirements.yaml:151:121: [error] line too long (128 > 120 characters) (line-length)

Changed title from "The tool shall allow a test to satisfy multiple requirements when referenced with and without file filters." (128 chars) to "The tool shall match tests to multiple requirements with mixed filter references." (102 chars)

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot Quality checks broken again - please run all quality checks - the following is one that got broken but there may be more:
`Error: requirements.yaml:151:121: [error] line too long (128 > 120 ...

Fixed the yamllint error by shortening the TEST-010 title from 128 to 102 characters. All quality checks now pass (yamllint, build, and tests). Commit: 393ca0f

@Malcolmnixon Malcolmnixon marked this pull request as ready for review January 13, 2026 05:35
@Malcolmnixon Malcolmnixon merged commit b6e9e05 into main Jan 13, 2026
13 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/test-detection-multiple-requirements branch January 13, 2026 05:36
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.

[Bug]: Tests referenced both with and without file-filters are not recognized

2 participants