A set of runsettings item templates for Visual Studio 2022, 2019 and 2017. [For earlier versions see the links below]
The runsettings file is used by all developers who love unit tests.
This template automates the creation of the default runsettings under solution items. Never do this manually again!
The runsettings contains separate sections for the adapters. The settings for the NUnit Adapter is described here and MSTest adapter is described here.
Right click the solution. Choose Add | New Item and choose one of the Runsettings under General. Observe that the runsettings file was added as a Solution Item.
Note that if you drop the name, and just let the file be named .runsettings
it will be automatically picked up by Visual Studio.
The runsettings file is used by all developers who love unit tests.
This template automates the creation of the default runsettings under solution items. Never do this manually again!
Also used to change the code coverage analysis settings for a test run. Set which files should be included and excluded from analysis, and also set symbol search paths. Also set Runconfigurations and testrunparameters, and specific settings for NUnit and MSTest.
Learn how to configure and customize runsettings:
- https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022
- https://docs.microsoft.com/en-us/visualstudio/test/customizing-code-coverage-analysis?view=vs-2022
Enjoy!
It can also enable parallel run of unit tests. More information on MSTest parallel execution and more details here More information on NUnit parallel execution
There are 3 templates included, one complete which includes code coverage and parallel run, one with only code coverage, and one with only parallel run. The latter can also be used as the most simple runsettings template.
To enable automatic running of the runsettings file, rename the one you choose to .runsettings.
For more information see this blog post: How to exclude code from code coverage in Visual Studio
XUnit does not support the use of a runsettings file, but use environment variables instead. See the answer in this SO post and this github issue
Thanks to Adam Cogan for your help!