Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

Implements PublicApiAttribute across all test frameworks (TUnit, XUnit.V3, MSTest, NUnit) to enable consistent marking of PublicApi definitions in test projects, mirroring the existing FunctionalTestAttribute pattern.

Changes

  • Attribute implementation: Added PublicApiAttribute to each framework, inheriting from the appropriate base (CategoryTraitBaseAttribute, TestTraitBaseAttribute, or CategoryAttribute)
  • Internal constants: Added PublicApi constant to Internals.cs in each framework
  • Test coverage: Created unit tests and snapshot verifications for all .NET versions (6.0, 8.0, 9.0, 10.0)
  • Public API surface: Updated API snapshots to include the new attribute

Usage

[PublicApi]
public class MyPublicApiTests
{
    [Test]
    [PublicApi]
    public void ValidatePublicApiContract()
    {
        // Test implementation
    }
}

The attribute follows the same semantics as other test categorization attributes: applicable to Assembly, Class, or Method with AllowMultiple = true.

Original prompt

This section details on the original issue you should resolve

<issue_title>feature: PublicApiAttribute</issue_title>
<issue_description>### Prerequisites

  • I have searched for similar feature requests in both open and closed issues
  • I have read the documentation to confirm this feature doesn't already exist

Feature Description

Implement in each library an PublicApiAttribute similar to FunctionalTestAttribute

Use Case

To easy mark PublicApi Definitions in Test Projects

Proposed Solution

No response

Alternatives Considered

No response

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Implement PublicApiAttribute for libraries feat: Add PublicApiAttribute for marking PublicApi test definitions Jan 3, 2026
Copilot AI requested a review from samtrion January 3, 2026 14:28
@samtrion samtrion force-pushed the copilot/add-public-api-attribute branch from 715f981 to 0848f06 Compare January 3, 2026 14:57
Copilot AI and others added 2 commits January 3, 2026 15:57
Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
@samtrion samtrion force-pushed the copilot/add-public-api-attribute branch from 0848f06 to b1bef72 Compare January 3, 2026 14:57
@samtrion samtrion marked this pull request as ready for review January 3, 2026 14:57
@samtrion samtrion requested a review from a team as a code owner January 3, 2026 14:57
@samtrion samtrion added state:ready for merge Indicates that a pull request has been reviewed and approved, and is ready to be merged into the mai type:feature Indicates a new feature or enhancement to be added. labels Jan 3, 2026
@samtrion
Copy link
Member

samtrion commented Jan 3, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.82%. Comparing base (f131703) to head (54ac374).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #967      +/-   ##
==========================================
+ Coverage   83.54%   83.82%   +0.28%     
==========================================
  Files          84       88       +4     
  Lines         231      235       +4     
  Branches       17       17              
==========================================
+ Hits          193      197       +4     
  Misses         32       32              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samtrion samtrion merged commit 317b790 into main Jan 3, 2026
14 checks passed
@samtrion samtrion deleted the copilot/add-public-api-attribute branch January 3, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:ready for merge Indicates that a pull request has been reviewed and approved, and is ready to be merged into the mai type:feature Indicates a new feature or enhancement to be added.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: PublicApiAttribute

2 participants