gpt4 book ai didi

visual-studio-2017 - 是否可以将 MSTest V2 与 Visual Studio 2017 测试 Controller 和测试代理一起用于远程执行单元测试

转载 作者:行者123 更新时间:2023-12-03 22:20:53 24 4
gpt4 key购买 nike

目标

我希望能够在另一台机器上远程运行我的单元测试,因为它们与另一个应用程序的 UI 交互。为了清楚起见,这些测试不是编码的 UI 测试,它们是使用 FlaUI 的测试方法。与桌面交互。

问题

我无法让 Visual Studio 测试 Controller 和测试代理与 MSTest V2 一起使用。当我设置 .runsettings使用 .testsettings 的文件文件并发送至 ForcedLegacyMode就像文档说的 here我收到以下警告,并且没有测试加载到测试资源管理器中。

[11/22/2017 9:54:12 AM Warning] Index was outside the bounds of the array.
[11/22/2017 9:54:13 AM Warning] Index was outside the bounds of the array.
[11/22/2017 9:54:13 AM Warning] Index was outside the bounds of the array.
[11/22/2017 9:54:14 AM Warning] Warning : A testsettings file or a runsettings with a ForcedLegacyMode set to true is not supported with the MSTest V2 Adapter.

我希望我只是缺少一些可以放入我的 .runsettings的设置文件将允许我为我的测试 Controller 指定 url。

设置

这是我的 .runsettings.testsettings文件供引用。这些设置成功连接到机器,但是当我构建我的测试运行器时不再找到并运行测试。

.runSettings
  <?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>
</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 runtime -->
<TestRunParameters>
</TestRunParameters>

<!-- Adapter Specific sections -->

<!-- MSTest adapter -->
<MSTest>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
<CaptureTraceOutput>false</CaptureTraceOutput>
<DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
<DeploymentEnabled>False</DeploymentEnabled>
</MSTest>

</RunSettings>

.testsettings
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="rmoqa01" id="076be28c-d18b-46bf-ad20-4d43ec821ea4" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<RemoteController name="10.2.0.101" />
<Execution location="Remote">
<Hosts skipUnhostableTests="false">
<VSSDKTestHostRunConfig name="VS IDE" HiveKind="DevEnv" HiveName="15.0_c9b36733" xmlns="http://microsoft.com/schemas/VisualStudio/SDK/Tools/IdeHostAdapter/2006/06" />
</Hosts>
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
</TestTypeSpecific>
<AgentRule name="AllAgentsDefaultRole">
</AgentRule>
</Execution>
<Properties />
</TestSettings>

最佳答案

我开了一个issue在 mstest github 页面上,查看生成我的警告的源代码后,我看到它看起来可能没有解决方法。这是我在 MSTestDiscover.cs 中查看的源代码.

    // Scenarios that include testsettings or forcing a run via the legacy adapter are currently not supported in MSTestAdapter.
if (MSTestSettings.IsLegacyScenario(logger))
{
return;
}

编辑:2018 年 10 月 28 日

我上面链接的问题已更新为以下 response .

There are no plans to have remote execution capability through MSTVest2. You can use the test task in VSTS which supports distributed execution on multiple agents. https://docs.microsoft.com/en-us/vsts/pipelines/test/set-up-continuous-test-environments-builds?view=vsts

关于visual-studio-2017 - 是否可以将 MSTest V2 与 Visual Studio 2017 测试 Controller 和测试代理一起用于远程执行单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47440221/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com