【问题标题】:DeploymentEnabled false is not working in my runsettings fileDeploymentEnabled false 在我的运行设置文件中不起作用
【发布时间】:2020-10-31 11:20:47
【问题描述】:

我目前更新到了 Visual Studio 2017 企业版版本 15.9.24 。 我遇到的问题是我无法使用 运行设置文件。当我调试测试时,它从我的 TestResults Out 文件夹而不是 bin/debug 文件夹访问任何 dll 和部署的文件,因为我处于调试模式。当我运行 Visual Studio 2015 时,我使用的是 .testsettings 文件 并且能够从 bin/debug 文件夹运行我的测试。由于 .testsettings 是 将被弃用我决定转向运行设置。

搜索网络和堆栈有人说我需要将设置位于标记为 DeploymentEnabled 的运行设置文件中为 false 来实现这一点。我这样做了,但仍然出现错误,因为应用程序正在运行并试图从我的 TestResults Out 文件夹中访问文件。我还将运行设置更改为强制传统模式为 true,并添加了旧测试设置文件的目录,但仍然无法正常工作。

是否还有其他我没有考虑到的设置 还是我遗漏了什么或者我的运行设置有问题。
请在下面查看我当前运行设置文件的示例 感谢您提供的任何帮助或指导。

 <?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- Configurations that affect the Test Framework -->
  <RunConfiguration>
    <MaxCpuCount>1</MaxCpuCount>
    <!-- Path relative to directory that contains .runsettings file
    <ResultsDirectory>.\TestResults</ResultsDirectory> -->

    <!-- x86 or x64 -->
    <!-- You can also change it from the Test menu; choose "Processor Architecture for AnyCPU Projects" -->
    <TargetPlatform>x86</TargetPlatform>

    <!-- Framework35 | [Framework40] | Framework45 -->
    <TargetFrameworkVersion>Framework45</TargetFrameworkVersion>

    <!-- Path to Test Adapters -->
    <!--<TestAdaptersPaths>%SystemDrive%\Temp\foo;%SystemDrive%\Temp\bar</TestAdaptersPaths>-->

    <!-- TestSessionTimeout was introduced in Visual Studio 2017 version 15.5 -->
    <!-- Specify timeout in milliseconds. A valid value should be greater than 0 -->
    <TestSessionTimeout>15000000</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>
            <ModulePaths>
              <Exclude>
                <ModulePath>.*CPPUnitTestFramework.*</ModulePath>
              </Exclude>
            </ModulePaths>

            <!-- We recommend you do not change the following values: -->
            <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
            <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
            <CollectFromChildProcesses>True</CollectFromChildProcesses>
            <CollectAspDotNet>False</CollectAspDotNet>

          </CodeCoverage>
        </Configuration>
      </DataCollector>

    </DataCollectors>
  </DataCollectionRunSettings>

  <!-- Parameters used by tests at run time -->
  <TestRunParameters>
    <Parameter name="webAppUrl" value="http://localhost" />
    <Parameter name="xxxxUser" value="xxxxm,xxxxtAuto01,xxxxtAuto02,xxxxxtAuto03,xxxxtAuto04" />
    <Parameter name="xxxxxxxxxnbr" value="xx86,xx90,xx91,xx92,xx93" />
  </TestRunParameters>

  <!-- MSTest adapter -->
  <MSTest>
    <MapInconclusiveToFailed>true</MapInconclusiveToFailed>
    <CaptureTraceOutput>false</CaptureTraceOutput>
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>true</DeleteDeploymentDirectoryAfterTestRunIsComplete>
    <DeploymentEnabled>false</DeploymentEnabled>
    <!---->
    <ForcedLegacyMode>true</ForcedLegacyMode>
    <SettingsFile>%xxxx_Automation_Test\xxxx_Automation_Test\xxx_Automation_Test\xxxxAutomation.testsettings;</SettingsFile>
    <InProcMode>true</InProcMode>
    <KeepExecutorAliveAfterLegacyRun>False</KeepExecutorAliveAfterLegacyRun>
    <AssemblyResolution>
      <!--
      <Directory path="C:\xxx_Automation\xxxx_Automation_Test\xxx_Automation_Test\bin\" includeSubDirectories="false"/>-->
    </AssemblyResolution>
  </MSTest>

</RunSettings>

【问题讨论】:

    标签: visual-studio unit-testing testing visual-studio-2017 automated-tests


    【解决方案1】:

    我更新了我的运行设置以具有运行设置的文件名并 将 ForcedLegacyMode 更新为 true。

     <ForcedLegacyMode>true</ForcedLegacyMode>
    <SettingsFile>xxxxxAutomation.testsettings</SettingsFile>
    <KeepExecutorAliveAfterLegacyRun>False</KeepExecutorAliveAfterLegacyRun>
    <AssemblyResolution>
    

    【讨论】:

      猜你喜欢
      • 2019-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-01
      • 2016-07-10
      • 2015-05-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多