-
Notifications
You must be signed in to change notification settings - Fork 505
DeviceTests: Added Traits to headless runner #128
Conversation
This gets the Virtual/Physical DeviceType trait we will want to exclude (so it’s the opposite of the currently executing device type).
@@ -8,6 +11,9 @@ internal static class DeviceTypes | |||
{ | |||
public const string Physical = "Physical"; | |||
public const string Virtual = "Virtual"; | |||
|
|||
internal static string ToExclude => | |||
DeviceInfo.DeviceType == RuntimeDeviceType.Physical ? Virtual : Physical; |
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.
Something about this wording/idea is a bit annoying to my mind, but I can't really think of a better/different way right now.
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.
Yeah :( I agree...
{ | ||
var filters = new List<XUnitFilter> | ||
{ | ||
new XUnitFilter(Traits.DeviceType, Traits.DeviceTypes.ToExclude, true) |
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.
We may need to address this in future if we ever have to add more filters - maybe find a way to sync them up or something. We just have to remember to do this for each platform project.
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.
Yeah I suppose we could have a shared helper method to GetSharedFilters()
@Redth The style Cop got you! 😉 |
Description of Change
Adds the ability to filter device tests by traits.
For starters, the
DeviceType
trait is now excluded based on if the test runner is on a physical or virtual device (so if we're running onVirtual
, all tests marked with aDeviceType
trait ofDevice
will be skipped (and vice versa).We can add more traits as needed.
PR Checklist