有没有.runsettings文件?

时间:2013-04-16 13:56:06

标签: visual-studio unit-testing continuous-integration mstest

我正在寻找与vstest一起使用的.runsettings文件的文档。有没有xsd?

除了msdn文档中的一些示例文件外,我似乎找不到多少。

2 个答案:

答案 0 :(得分:12)

Runsettings(VS2012)类似于testsettings(VS2010),其中testsettings特定于为MSTest编写的测试。 VS2012支持不同适配器的设置。因此,架构不是封闭系统,因此XSD不够全面。

此MSDN文章列出了runsettings文件中元素的一些高级详细信息(https://msdn.microsoft.com/en-us/library/jj635153.aspx)。

以下是该文章的摘录。

<?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>

答案 1 :(得分:2)

我在这里找到了有关runsettings(特定于代码覆盖率)的更多信息:

http://msdn.microsoft.com/en-us/library/jj159530%28v=vs.110%29.aspx