I know it is possible to exclude the whole test project(s) from Live Unit Testing by right clicking on the test project and selecting the "Live Unit Testing" context menu.
But in my solution I have some long running/resource intensive tests, which I would like to exclude. Is it possible to exclude individual tests?
Easiest method is right clicking on the method in the editor view and selecting Live Unit Testing and Exclude.
You can also do it programatically with attributes.
For xUnit: [Trait("Category", "SkipWhenLiveUnitTesting")]
For NUnit: [Category("SkipWhenLiveUnitTesting")]
For MSTest: [TestCategory("SkipWhenLiveUnitTesting")]
more info at Microsoft docs
来源:https://stackoverflow.com/questions/47157050/live-unit-testing-exclude-tests