Replies: 1 comment 4 replies
-
|
Happy to bake these in. I've actually needed them myself in my test project: https://github.com/thomhurst/TUnit/blob/feature/refactor-contexts/TUnit.TestProject/WindowsOnlyAttribute.cs We can probably just reduce it to two attributes with an operating system enum
This would allow easily specifying multiple values if the enum uses flags too.
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to propose adding platform-specific derivations of the existing
[Skip]to better support conditional test execution across runtime environments.Suggested attributes:
RunOnlyOnWindowsAttributeRunNotOnWindowsAttributeRunOnlyOnLinuxAttributeRunNotOnLinuxAttributeRunOnlyOnMacOsAttributeRunNotOnMacOsAttributeMotivation
In real-world .NET projects—especially those targeting multiple platforms or maintaining legacy support for .NET Framework—it's common to encounter tests that are only valid under certain operating systems. Currently, developers often use inline checks or rely on third-party solutions to manage this. While that works, it's not ideal.
These new attributes would provide:
SkippableFactorConditionalFactoften require additional packages or custom implementations.Why now?
Introducing these attributes early would strengthen TUnit's positioning as a pragmatic, developer-centric testing framework. It would add clarity, eliminate friction, and improve test hygiene—especially in modern development environments that combine legacy systems with cross-platform .NET code.
Happy to contribute a PR if there's interest. Looking forward to your thoughts!
Beta Was this translation helpful? Give feedback.
All reactions