Skip to content

[test-improver] test: add abstract method edge case test for MSTEST0041 (UseDeploymentItemWithTestMethodOrTestClass)#8721

Merged
Evangelink merged 1 commit into
mainfrom
test-assist/deployment-item-edge-cases-7f3599e6960f716d
Jun 1, 2026
Merged

[test-improver] test: add abstract method edge case test for MSTEST0041 (UseDeploymentItemWithTestMethodOrTestClass)#8721
Evangelink merged 1 commit into
mainfrom
test-assist/deployment-item-edge-cases-7f3599e6960f716d

Conversation

@Evangelink

@Evangelink Evangelink commented May 31, 2026

Copy link
Copy Markdown
Member

🤖 This PR was created by Test Improver, an automated AI assistant focused on improving tests for this repository.

Goal and Rationale

UseDeploymentItemWithTestMethodOrTestClassAnalyzer (MSTEST0041) has a documented design decision — that abstract methods are treated differently from abstract classes — which was not covered by any test.

Approach

Added 1 new test case:

Test Scenario
WhenAbstractMethodHasDeploymentItemWithoutTestMethod_Diagnostic Documents the design decision: abstract classes skip the check (inherited attributes), but abstract methods do not — an abstract method with [DeploymentItem] but no [TestMethod] is flagged

The abstract method test is anchored in an existing code comment in the analyzer:

For now, we do the IsAbstract check specifically for classes and not methods. If we got a convincing feedback around a false positive for the attribute on an abstract method, we can adjust the check.

A test that documents this intent makes future changes safer.

Test Status

✅ Build succeeded
✅ All tests passed

Trade-offs

Purely additive test changes — no production code modifications. This test follows the same VerifyCS pattern already established in the file.

Copilot AI review requested due to automatic review settings May 31, 2026 23:34
@Evangelink Evangelink added type/automation Created or maintained by an agentic workflow. type/test-gap Missing or insufficient tests. labels May 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds VB.NET test coverage and an abstract-method edge case test for the UseDeploymentItemWithTestMethodOrTestClassAnalyzer (MSTEST0041), which previously had no VB.NET tests despite declaring VB support.

Changes:

  • Adds VerifyVB using-alias and 4 VB.NET test cases mirroring existing C# scenarios.
  • Adds an abstract-method edge case test documenting the analyzer's intentional behavior of flagging abstract methods (unlike abstract classes).
Show a summary per file
File Description
test/UnitTests/MSTest.Analyzers.UnitTests/UseDeploymentItemWithTestMethodOrTestClassAnalyzerTests.cs Adds 5 new test cases (1 C# abstract method, 4 VB.NET) for MSTEST0041 analyzer.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@Evangelink Evangelink marked this pull request as ready for review June 1, 2026 07:46
…tItemWithTestMethodOrTestClass)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink force-pushed the test-assist/deployment-item-edge-cases-7f3599e6960f716d branch from 9c76c57 to 9b46d3b Compare June 1, 2026 08:35
@Evangelink Evangelink changed the title [test-improver] test: add VB.NET and abstract method edge case tests for MSTEST0041 (UseDeploymentItemWithTestMethodOrTestClass) [test-improver] test: add abstract method edge case test for MSTEST0041 (UseDeploymentItemWithTestMethodOrTestClass) Jun 1, 2026
@Evangelink Evangelink merged commit f19189e into main Jun 1, 2026
14 of 24 checks passed
@Evangelink Evangelink deleted the test-assist/deployment-item-edge-cases-7f3599e6960f716d branch June 1, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/automation Created or maintained by an agentic workflow. type/test-gap Missing or insufficient tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants