Skip to content

OsirisTerje/RunSettings

Repository files navigation

RunSettings for "real" developers who write unit tests

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.

How to use

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.

Details

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:

Enjoy!

Parallel execution

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

Templates

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 

Why are there no settings for XUnit included

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

Older Visual Studio versions:

VS 2015 version

VS 2013 version 

VS 2012 version

Credits

Thanks to Adam Cogan for your help!