-
-
Notifications
You must be signed in to change notification settings - Fork 106
Add Skip.Test() documentation for dynamic test skipping #4018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ipping Co-authored-by: thomhurst <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive documentation for dynamic test skipping at runtime using the Skip.Test() API and its variants (Skip.When(), Skip.Unless()), addressing a gap in the existing skip documentation.
Key Changes
- Added a new "Dynamic Skipping at Runtime" section explaining when and how to use
Skip.Test(reason)for runtime test skipping - Documented conditional skip helpers
Skip.When()andSkip.Unless()with practical examples - Provided examples of using skip methods in test hooks (
Before(Test)andBefore(Class))
| [Test] | ||
| public void Test1() | ||
| { | ||
| // This test will be skipped if database is unavailable |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent punctuation in comment. The comment should end with a period for consistency with other comments in the documentation (e.g., line 93, 172, 206).
Suggested change:
// This test will be skipped if database is unavailable.| // This test will be skipped if database is unavailable | |
| // This test will be skipped if database is unavailable. |
| [Test] | ||
| public void Test2() | ||
| { | ||
| // This test will also be skipped if database is unavailable |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent punctuation in comment. The comment should end with a period for consistency with other comments in the documentation (e.g., line 93, 172, 206).
Suggested change:
// This test will also be skipped if database is unavailable.| // This test will also be skipped if database is unavailable | |
| // This test will also be skipped if database is unavailable. |
| [Test] | ||
| public void Test1() | ||
| { | ||
| // All tests in this class will be skipped if service is unavailable |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent punctuation in comment. The comment should end with a period for consistency with other comments in the documentation (e.g., line 93, 172, 206).
Suggested change:
// All tests in this class will be skipped if service is unavailable.| // All tests in this class will be skipped if service is unavailable | |
| // All tests in this class will be skipped if service is unavailable. |
|
|
||
| Skip.When(isCI, "This test doesn't run in CI environments"); | ||
|
|
||
| // Test continues only when not in CI |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent punctuation in comment. The comment should end with a period for consistency with other comments in the documentation (e.g., line 93, 172, 206).
Suggested change:
// Test continues only when not in CI.| // Test continues only when not in CI | |
| // Test continues only when not in CI. |
|
|
||
| Skip.Unless(hasRequiredPermissions, "User doesn't have required permissions"); | ||
|
|
||
| // Test continues only if user has permissions |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent punctuation in comment. The comment should end with a period for consistency with other comments in the documentation (e.g., line 93, 172, 206).
Suggested change:
// Test continues only if user has permissions.| // Test continues only if user has permissions | |
| // Test continues only if user has permissions. |
Please check the following before creating a Pull Request
Description
The skipping documentation was missing coverage of
Skip.Test(reason)and its variants for runtime test skipping.Changes
Added comprehensive "Dynamic Skipping at Runtime" section to
docs/docs/test-authoring/skip.mdcovering:Skip.Test(reason)- Core method for dynamic skipping within test methods or hooksSkip.When(condition, reason)- Conditional skip when condition is trueSkip.Unless(condition, reason)- Conditional skip unless condition is trueBefore(Test)andBefore(Class)hooks[Skip]attributeExample
Documentation builds successfully with no errors.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.