Reputation: 780
I'm trying to filter out some unit test marked with the xunit trait category. On my build server I don't want unit test to run with category integration
[Trait("Category", "Integration")]
When I don't use the 'Test Filter criteria' in TFS VS test step, the unit test all get executed. But when I apply the desired filter
Category!=Integration
It doesn't run any tests at all. I've tried all variations but no success. I also tried using the 2.* version of the test task.
Upvotes: 4
Views: 2246
Reputation: 3427
Now (Februaray 2022), this is not problem anymore. However, I have had some issues getting it working and I have ended up here anyway, so just couple of points:
Upvotes: 0
Reputation: 21
Instead of using [Trait("Category", "Integration")], use [Trait("TestCategory", "Integration")]. XUnit doesn't care what you put in for these key-value pairs, but the TFS Test runner task DOES. The Test Filter Criteria box only works with a prescribed set of attributes. I have this working for our builds. Ran into the same problem you are describing. After analyzing the build output, (and getting ALL test projects switched to XUnit - that is also a key... don't have a mix of MSTest and XUnit).
Upvotes: 2