开发者

In MSTest's Test View, how can I get a list of all Tests with no category?

开发者 https://www.devze.com 2023-01-26 03:24 出处:网络
I\'m using MSTest and most of my unit tests have no TestCategory attribute, but I want to put a few tests into a \"Slow\" category.Then I want to be able to easily run all the tests that have no categ

I'm using MSTest and most of my unit tests have no TestCategory attribute, but I want to put a few tests into a "Slow" category. Then I want to be able to easily run all the tests that have no category assigned.

When I go to Test View, I can filter by Test Catego开发者_开发知识库ries, but I can't put in a keyword of empty. I can easily find my "Slow" ones, but how to I find my non-Slow ones? I'm trying to avoid putting a test category on all my tests.

I guess it's not the end of the world if I have to... a search and replace should get them all, but if there's a way to find the non-categorized, I would like to know.


You can also exclude these tests from the command line.

mstest /testcontainer:foo.tests.dll /category:!Slow


In the test list editor, add Test Categories as a column, group by None, and sort on Test Categories. Tests with no categories will be at the top. Unfortunately, you can't group by Test Category.


It seems that /category:!Slow doesn't work at all. Bad thing! So it's necessary to put, for example [TestCategory("unit")] attribute to all of the tests.

Another, better way is to separate unit and integration tests by projects and run such tests separately.

0

精彩评论

暂无评论...
验证码 换一张
取 消