-
Notifications
You must be signed in to change notification settings - Fork 2
XUnit Traits
#XUnit Custom Traits
The XUnit trait attribute is fantastic, it makes for an easy way to group and run (through the command line) tests. However unlike many unit tests, UI automation tests often require many tags, and having one line for each is kind of a pain.
Because of this the CustomTrait
attribute is included in the Aliases.Executors.XUnit
package.
This trait allows for semi-colon (;) delimited traits to be added to tests via an attribute.
If you don't like my version just copy it and make your own.
Making custom traits for XUnit is not a very well documented feature (at the time of me writing this). But there are two parts to it:
- An
ITraitDiscoverer
, This does the majority of the work and actually parses the trait values. - An
ITraitAttribute
, This is how XUnit finds your trait and uses it.
And that's it, you are on your way to making custom trait attributes. You could even populate the values from a database if you really wanted to.