Repository navigation
Add CIConditionAttribute to support CI-specific test execution control - #5797
Merged
Merged
Conversation
Co-authored-by: Evangelink <[email protected]>
Co-authored-by: Evangelink <[email protected]>
Copilot
AI
changed the title
[WIP] Add
Add CIConditionAttribute to support CI-specific test execution control
Jun 17, 2025
CIConditionAttribute…ework pattern Co-authored-by: Youssef1313 <[email protected]>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Youssef1313 <[email protected]>
…te.cs Co-authored-by: Youssef1313 <[email protected]>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Youssef1313 <[email protected]>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ame and assertion Co-authored-by: Youssef1313 <[email protected]>
Amaury Levé (Evangelink)
marked this pull request as ready for review
July 15, 2025 07:37
Amaury Levé (Evangelink)
enabled auto-merge (squash)
July 15, 2025 07:37
Amaury Levé (Evangelink)
approved these changes
Jul 15, 2025
Youssef Fahmy (Youssef1313)
approved these changes
Jul 15, 2025
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.
This PR implements
CIConditionAttributeto allow developers to conditionally run or skip tests based on whether they are executing in a Continuous Integration (CI) environment.Summary
The new attribute addresses a common need in test suites where certain tests should behave differently in CI environments - either running only in CI or being temporarily disabled in CI (e.g., for flaky tests).
Usage
Implementation Details
Follows existing patterns: Inherits from
ConditionBaseAttributelikeOSConditionAttributeComprehensive CI detection: Supports major CI systems including:
GITHUB_ACTIONS)TF_BUILD)APPVEYOR)TRAVIS)CIRCLECI)BUILD_ID+BUILD_URL)TEAMCITY_VERSION)CODEBUILD_BUILD_ID+AWS_REGION)BUILD_ID+PROJECT_ID)JB_SPACE_API_URL)CI)CI detection logic: Based on the well-documented detection from .NET SDK telemetry (https://learn.microsoft.com/dotnet/core/tools/telemetry#continuous-integration-detection)
Comprehensive testing: 20+ unit tests covering all CI detection scenarios and edge cases
API consistency: Updated PublicAPI files for proper API tracking
Use Cases
The attribute can be applied to both test methods and test classes, supporting standard MSTest condition attribute grouping behavior.
Fixes #5533.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.