Uh oh!
There was an error while loading. Please reload this page.
Add MSTEST0035 tests for custom RetryBaseAttribute subclasses - #9923
Conversation
Add four tests covering the Inherits() path for custom derived RetryBaseAttribute subclasses in UseRetryWithTestMethodAnalyzer: - WhenNonTestMethodHasCustomDerivedRetryAttribute_Diagnostic - WhenTestMethodHasCustomDerivedRetryAttribute_NoDiagnostic - WhenNonTestClassHasCustomDerivedRetryAttribute_Diagnostic - WhenTestClassHasCustomDerivedRetryAttribute_NoDiagnostic These tests confirm that user-defined RetryBaseAttribute subclasses are correctly handled by the Inherits() check in the analyzer. Fixes#9918 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: efa48d3b-7307-4c38-a477-815b089201c5
There was a problem hiding this comment.
Pull request overview
Adds MSTEST0035 coverage for custom RetryBaseAttribute subclasses.
Changes:
- Tests diagnostic behavior on non-test methods and classes.
- Tests no-diagnostic behavior on valid test methods and classes.
Show a summary per file
| File | Description |
|---|---|
test/UnitTests/MSTest.Analyzers.UnitTests/UseRetryWithTestMethodAnalyzerTests.cs | Adds four custom retry attribute analyzer tests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Medium
This comment has been minimized.
This comment has been minimized.
Regenerated via UpdateXlf. The last localized check-in added translations for 'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru) that XliffTasks rejects (placeholder mismatch), breaking the build with "xlf is out-of-date with resx". UpdateXlf resets those two units to state="new" so the build passes; they will be re-translated on the next localization pass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
| - la classe doit être « public » | ||
| -La classe doit être marquée avec « [TestClass] » (ou un attribut dérivé). | ||
| - la classe ne doit pas être générique.</target> | ||
| <target state="new">Methods marked with '[GlobalTestInitialize]' or '[GlobalTestCleanup]' should follow the following layout to be valid: |
Uh oh!
There was an error while loading. Please reload this page.
🧪 Test quality grade — PR #9923
This advisory comment was generated automatically. Grades are heuristic Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Uh oh!
There was an error while loading. Please reload this page.
Fixes#9918
Goal
UseRetryWithTestMethodAnalyzer(MSTEST0035) usesInherits()to detect any subclass ofRetryBaseAttribute— not just the built-in[Retry]. The existing tests only exercised[Retry]directly. This PR adds four tests that exercise theInherits()path via a user-definedMyRetryAttribute : RetryBaseAttributesubclass.Coverage
[TestMethod])[TestClass])The test helper class uses
#pragma warning disable MSTESTEXPto suppress the experimental diagnostic onRetryResult/RetryContext, andprotected override(matching the base member visibility as seen from an external assembly).Validation
Built and ran
MSTest.Analyzers.UnitTestsfor bothnet472andnet8.0— all tests pass.