Skip to content

Instantly share code, notes, and snippets.

@osmyn
Created December 26, 2018 13:54
Show Gist options
  • Save osmyn/affc8841111283dc8b3ca1a95ace0dc2 to your computer and use it in GitHub Desktop.
Save osmyn/affc8841111283dc8b3ca1a95ace0dc2 to your computer and use it in GitHub Desktop.
Example unit test runsettings file to exclude tests based on name, library, method, etc.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<!-- Path relative to solution directory -->
<ResultsDirectory>.\TestResults</ResultsDirectory>
<!-- x86 or x64 -->
<!-- You can also change it from menu Test > Test Settings > Default Processor Architecture -->
<TargetPlatform>x86</TargetPlatform>
<!-- Framework35 | [Framework40] | Framework45 -->
<TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
<!-- Path to Test Adapters -->
<!--<TestAdaptersPaths>%SystemDrive%\Temp\foo;%SystemDrive%\Temp\bar</TestAdaptersPaths>-->
<!-- TestSessionTimeout is only available with Visual Studio 2017 version 15.5 and higher -->
<!-- Specify timeout in milliseconds. A valid value should be greater than 0 -->
<TestSessionTimeout>10000</TestSessionTimeout>
</RunConfiguration>
<!-- Configurations for data collectors -->
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<!-- Exclude .dll's by file name pattern -->
<ModulePaths>
<Exclude>
<ModulePath>.*Tests.dll</ModulePath>
<ModulePath>.*\\moq\.dll$</ModulePath>
</Exclude>
</ModulePaths>
<!-- Exclude anything in the project DataAccess' folder Entities -->
<Functions>
<Exclude>
<Function>^DataAccess\.Entities\..*</Function>
</Exclude>
</Functions>
<!-- Exclude file names -->
<Sources>
<Exclude>
<Source>.*\\Global.asax.cs*</Source>
</Exclude>
</Sources>
<!-- Exclude company name as listed in the assembly file -->
<CompanyNames>
<Exclude>
<CompanyName>.*microsoft.*</CompanyName>
</Exclude>
</CompanyNames>
<!-- Exclude by public key token of an assembly -->
<PublicKeyTokens>
<Exclude>
<PublicKeyToken>^B77A5C561934E089$</PublicKeyToken>
</Exclude>
</PublicKeyTokens>
<!-- Microsoft recommends you do not change the following values: -->
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<CollectAspDotNet>False</CollectAspDotNet>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment