having:
[Category("Contract")]
public class ProgramClientShould
{
}
or:
[Trait("Contract", null)]
public class ProgramClientShould
{
}
and Resharper -> Options -> Tools -> Unit Testing: "Skip tests from categories" with value "Contract"
Still, tests in ProgramClientShould are executed. What's wrong?
When using the default testing framework in . NET your tests will be decorated with a testmethod attribute and you can just place the ignore attribute above them. When you have the ignore attribute above a testmethod the test will be skipped. Now when you run your tests you will see that this test has been skipped.
Categorizing Using xUnit Trait The standard way of categorizing tests in xUnit is by using Trait.
This method is decorated with the Fact attribute, which tells xUnit that this is a test.
Running unit tests in parallel is a new feature in xUnit.net version 2. There are two essential motivations that drove us to not only enable parallelization, but also for it to be a feature that's enabled by default: As unit testing has become more prevalent, so too have the number of unit tests.
xunit doesn't have a Category
attribute, so the resharper runner won't recognise that. As for the trait attribute, you need to provide a value, then filter for something in the format key[value]
. E.g. if you want to use [Trait("Owner", "Matt")]
, you would filter for a category of Owner[Matt]
.
The trait key Category
is treated differently, and just the value is used, so [Trait("Category", "integration")]
would use integration
as the category filter in the resharper options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With