[test-improver] test: add edge case tests for TestMethodShouldNotBeIgnoredAnalyzer (MSTEST0015)#8869
Merged
Evangelink merged 2 commits intoJun 7, 2026
Conversation
…STEST0015)
Add four new test cases that document and verify distinct behavioral
edges of the MSTEST0015 analyzer:
- WhenDataTestMethodIsIgnored_Diagnostic: [DataTestMethod] is a
TestMethod derivative and should trigger MSTEST0015 when paired
with [Ignore].
- WhenMultipleTestMethodsAndOnlyOneIsIgnored_DiagnosticOnlyForIgnoredMethod:
only the method that bears [Ignore] receives the diagnostic; the
un-ignored sibling method is clean.
- WhenOnlyClassLevelIgnoreWithNoMethodLevelIgnore_NoDiagnostic:
MSTEST0015 inspects method-level attributes only, so a class-level
[Ignore] without any method-level [Ignore] does not fire.
- WhenIgnoredTestMethodHasMessage_Diagnostic: providing a justification
message in [Ignore("...")]] satisfies MSTEST0014
(IgnoreShouldHaveJustification) but MSTEST0015 still fires because
the test remains ignored.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the unit test coverage for the TestMethodShouldNotBeIgnoredAnalyzer (MSTEST0015) in MSTest.Analyzers by adding new edge-case scenarios to clarify intended analyzer behavior around ignored tests.
Changes:
- Added a test ensuring
[DataTestMethod]with[Ignore]still triggers MSTEST0015. - Added a test verifying only the ignored method is diagnosed when a class has mixed ignored/non-ignored test methods.
- Added a test confirming class-level
[Ignore]alone does not trigger MSTEST0015. - Added a test confirming
[Ignore("...")](with justification) still triggers MSTEST0015.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTests/MSTest.Analyzers.UnitTests/TestMethodShouldNotBeIgnoredAnalyzerTests.cs | Adds 4 new analyzer tests covering [DataTestMethod], mixed ignored/non-ignored methods, class-level ignore behavior, and ignore-with-message behavior. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
2 tasks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Test Improver — automated AI assistant focused on improving tests for this repository.
Goal and Rationale
TestMethodShouldNotBeIgnoredAnalyzer(MSTEST0015) had only 4 tests. Three important behavioral boundaries were untested:[DataTestMethod](aTestMethodAttributederivative paired with[Ignore])[Ignore](without method-level) triggers the rule[Ignore]with a justification message still fires MSTEST0015 (vs. MSTEST0014)These are the scenarios users most commonly ask about when enabling this rule.
Approach
Added four new tests:
WhenDataTestMethodIsIgnored_Diagnostic[DataTestMethod]is aTestMethodAttributederivative — it should be treated like[TestMethod]WhenMultipleTestMethodsAndOnlyOneIsIgnored_DiagnosticOnlyForIgnoredMethod[Ignore]gets a diagnostic; the un-ignored sibling is cleanWhenOnlyClassLevelIgnoreWithNoMethodLevelIgnore_NoDiagnostic[Ignore]doesn't fire itWhenIgnoredTestMethodHasMessage_DiagnosticTrade-offs
Minimal maintenance burden — straightforward analyzer verifications with no mocking or state.
Test Status
✅ All 8 tests passed (
MSTest.Analyzers.UnitTestsnet8.0, 0 warnings, 0 errors)Reproducibility
Add this agentic workflows to your repo
To install this agentic workflow, run