Search code examples
visual-studiounit-testingcontinuous-integrationmstest

Is there any .runsettings documentation?


I'm looking for documentation for .runsettings files as used with vstest. Is there an xsd?

I can't seem to find much except for a few example files in the msdn documentation.


Solution

  • Runsettings (VS2012) are similar to testsettings (VS2010) where testsettings is specific to tests written for MSTest. VS2012 supports settings for different adapters. As such, the schema isn't a closed system so an XSD would not be comprehensive.

    This MSDN article lists some high level details (https://msdn.microsoft.com/en-us/library/jj635153.aspx) for the elements in the runsettings file.

    Here's a snippet from that article.

    <?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] | 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>
       </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>
                   <ModulePaths>
                     <Exclude>
                        <ModulePath>.*CPPUnitTestFramework.*</ModulePath>
                     </Exclude>
                   </ModulePaths>
                 </CodeCoverage>
               </Configuration>
            </DataCollector>
         </DataCollectors>
      </DataCollectionRunSettings>
    
      <!-- Parameters used by tests at runtime -->
      <TestRunParameters>
        <Parameter name="webAppUrl" value="http://localhost" />
        <Parameter name="webAppUserName" value="Admin" />
        <Parameter name="webAppPassword" value="Password" />
      </TestRunParameters>
    
      <!-- Adapter Specific sections -->
      <!-- MSTest adapter -->
      <MSTest>
         <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
         <CaptureTraceOutput>false</CaptureTraceOutput>
         <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
         <DeploymentEnabled>False</DeploymentEnabled>
         <AssemblyResolution>
            <Directory Path>"D:\myfolder\bin\" includeSubDirectories="false"/>
         </AssemblyResolution>
      </MSTest>
    
    </RunSettings>