resharper is not ignoring tests marked with Category Attribute in XUnit

2k views Asked by At

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?

1

There are 1 answers

3
citizenmatt On BEST ANSWER

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.