Skip to content

Conversation

@thomhurst
Copy link
Owner

Summary

  • Fix false positive TUnit0059 warning when an abstract test class with data sources has no concrete subclasses in the same assembly
  • This supports the "testing library" pattern where abstract test classes are defined in a library meant to be subclassed by consuming assemblies

Changes

  • Modified AbstractTestClassWithDataSourcesAnalyzer to track whether any concrete subclasses exist
  • Added filter to only consider source-defined types (not from referenced assemblies)
  • Updated diagnostic logic to only warn when there ARE concrete subclasses that are missing [InheritsTests]
  • Updated tests to reflect the new expected behavior

Behavior

Scenario Old Behavior New Behavior
Abstract class with no subclasses ⚠️ Warning ✅ No warning
Abstract class with subclass missing [InheritsTests] ⚠️ Warning ⚠️ Warning
Abstract class with subclass having [InheritsTests] ✅ No warning ✅ No warning

Fixes #4607

Test plan

  • Updated existing analyzer tests
  • All AbstractTestClassWithDataSourcesAnalyzerTests pass

Don't warn about abstract test classes with data sources when there are
no concrete subclasses in the same assembly. This supports the library
pattern where abstract test classes are meant to be subclassed by
consuming assemblies.

Fixes #4607
@claude
Copy link
Contributor

claude bot commented Jan 29, 2026

No issues found. Checked for bugs and CLAUDE.md compliance.

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]: TUnit0059 false positive when there are no subclasses in the same assembly

2 participants