I currently manually add -trait="Integration"
to the Test Explorer search to make sure I don't run any tests marked as Integration.
How can I make this the default?
CodePudding user response:
There doesn't seem to be a way to default this search, but I think a good solution to your problem is to make use of a playlist and add all of the tests with the "Integration" trait to the playlist.
- Right click in the "Tests" portion of the Test Explorer window and select Add to playlist → New playlist. This will open another text explorer window with your newly created playlist.
- Click the pencil icon to edit the playlist
- Filter using the search bar on your trait criteria.
- Select all the tests you wish to add to the playlist (probably all of them in this case).
- Save the playlist using the floppy disk icon.
You can even pin this playlist window like any other window. The only downside to this is you have to continue to add new tests to it as you go. However that should be fairly easy to do via these steps.
CodePudding user response:
You could define the filter in a vstest.runsettings file:
<RunSettings>
<RunConfiguration>
<TestCaseFilter>TestCategory!=Integration</TestCaseFilter>
</RunConfiguration>
</RunSettings>
The TestCaseFilter
element uses the same syntax as the command line expression used in dotnet test --filter
(https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=mstest).