繁体   English   中英

VS 2017 15.7.1 - “旧”单元测试无法运行

[英]VS 2017 15.7.1 - “old” unit tests not runnable

我有一堆用 VS 2015 编写的单元测试。升级到 2017 时,同样的测试也有效。然后我在 VS 2017 更新后出现系统故障,然后我重新安装了系统和一个新的 VS 2017 15.7。 1.

单元测试是基本的 MSTest,一些简单的测试只是调用类库中的一些类,这些类从一些 excel 文件中获取数据。 还有一些更复杂的,运行 Selenium Webdriver 并执行此操作。

现在,在 VS 2017 15.7.1 中,所有测试都不再起作用。 也就是说,它们根本没有运行。 运行它们时,测试资源管理器中的进度条正常显示移动的绿色,然后它会变回白色,并且测试仍然显示为未运行。

将日志记录级别设置为诊断时,输出是这样的:

[14.05.18 15:12:50 Diagnostic] About to Enqueue operation 'RunSelectedOperation', hashcode:21607723 
[14.05.18 15:12:50 Diagnostic] Enqueue operation 'RunSelectedOperation', hashcode:21607723 
[14.05.18 15:12:50 Diagnostic] Operation left in the the queue: 1
[14.05.18 15:12:50 Diagnostic]  'RunSelectedOperation', hashcode:21607723
[14.05.18 15:12:50 Diagnostic]

[14.05.18 15:12:50 Diagnostic] Processing Queue .....
[14.05.18 15:12:50 Diagnostic] Operation Dequeue : 'RunSelectedOperation'
[14.05.18 15:12:50 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=OperationSetStarted, operationInProgress=False
[14.05.18 15:12:50 Diagnostic] TestDiscoveryStats.OperationStateChanged State=OperationSetStarted, InProgress=False
[14.05.18 15:12:50 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=ChangeDetectionStarting, operationInProgress=True
[14.05.18 15:12:50 Diagnostic] TestDiscoveryStats.OperationStateChanged State=ChangeDetectionStarting, InProgress=False
[14.05.18 15:12:50 Diagnostic] We programmatically start the build in TestWindowHost.UpdateContainer... 
[14.05.18 15:12:50 Diagnostic] After we await the build that programmatically started in TestWindowHost.UpdateContainer... 
[14.05.18 15:12:50 Diagnostic] TestContainer update (build) complete : 266 ms
[14.05.18 15:12:50 Diagnostic] Adding the Project in Project Map for Guid 098d9992-63a7-41c5-b5b3-6ce5e783f868
[14.05.18 15:12:50 Diagnostic] Time taken for fetching Roslyn supported projects: 0 milliseconds.
[14.05.18 15:12:50 Diagnostic] Adding the Project in Project Map for Guid 1e96f94e-161d-41eb-8546-edd8cd13aff4
[14.05.18 15:12:50 Diagnostic] Adding the Project in Project Map for Guid 3a39b466-3d4f-4a0c-b110-f045d0975713
[14.05.18 15:12:50 Diagnostic] Adding the Project in Project Map for Guid 69c4cbe6-5541-45ac-8d23-852bce725f99
[14.05.18 15:12:50 Diagnostic] Adding the Project in Project Map for Guid 1b84143e-3826-4937-8073-0d2a9b89982a
[14.05.18 15:12:50 Diagnostic] Adding the Project in Project Map for Guid e30be865-289f-4f78-8d26-9fd1802cf87b
[14.05.18 15:12:51 Diagnostic] Adding the Project in Project Map for Guid 79f803ca-528e-419f-92e8-d9df4c5624d0
[14.05.18 15:12:51 Diagnostic] Adding the Project in Project Map for Guid fe6a60de-81f3-4f58-bb72-47956957e916
[14.05.18 15:12:51 Diagnostic] Adding the Project in Project Map for Guid 36f10149-4d39-47f5-924f-726b36f30b83
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://vsprojectoutputcontainerdiscoverer/v1, discovered 8 containers
[14.05.18 15:12:51 Diagnostic] Containers from 'Microsoft.VisualStudio.TestWindow.VsAdapters.VsProjectOutputContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\Authentication\bin\Debug\Authentication.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\Common\bin\Debug\Common.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\FlowTests\bin\Debug\FlowTests.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\Opus3TestAutomation\bin\Debug\Opus3TestAutomation.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\OpusAutomation\bin\Debug\OpusAutomation.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\OpusResources\bin\Debug\OpusResources.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\OpusTests\bin\Debug\OpusTests.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic]  C:\Source\Workspaces\QA\Opus3TestAutomation\TestData\bin\Debug\TestData.dll:executor://vsprojectoutputcontainerdiscoverer/v1
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://testexplorerservicecontainerdiscoverer/v1, discovered 0 containers
[14.05.18 15:12:51 Diagnostic] No containers found from 'Microsoft.VisualStudio.TestWindow.Extensibility.TestExplorerServiceContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://cpsprojectoutputtestcontainerdiscoverer/v2, discovered 0 containers
[14.05.18 15:12:51 Diagnostic] No containers found from 'Microsoft.VisualStudio.TestWindow.Extensions.CPSTestContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://powershelltestexecutor/v1, discovered 0 containers
[14.05.18 15:12:51 Diagnostic] No containers found from 'PowerShellTools.TestAdapter.PowerShellTestContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://orderedtestadapter/v1, discovered 0 containers
[14.05.18 15:12:51 Diagnostic] No containers found from 'Microsoft.VisualStudio.MSTest.TestWindow.OrderedTestContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://generictestadapter/v1, discovered 0 containers
[14.05.18 15:12:51 Diagnostic] No containers found from 'Microsoft.VisualStudio.MSTest.TestWindow.GenericTestContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic] test container discoverer executor://webtestadapter/v1, discovered 0 containers
[14.05.18 15:12:51 Diagnostic] No containers found from 'Microsoft.VisualStudio.MSTest.TestWindow.WebTestContainerDiscoverer' :
[14.05.18 15:12:51 Diagnostic] DiscoveryOperation<RunSelectedOperation> FinishedChangedCotainers, changed container count is 0
[14.05.18 15:12:51 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=ChangeDetectionFinished, operationInProgress=False
[14.05.18 15:12:51 Diagnostic] TestDiscoveryStats.OperationStateChanged State=ChangeDetectionFinished, InProgress=False
[14.05.18 15:12:51 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionStarting, operationInProgress=False
[14.05.18 15:12:51 Diagnostic] TestDiscoveryStats.OperationStateChanged State=TestExecutionStarting, InProgress=False
[14.05.18 15:12:51 Informational] ------ Run test started ------
[14.05.18 15:12:51 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionStarted, operationInProgress=False
[14.05.18 15:12:51 Diagnostic] TestDiscoveryStats.OperationStateChanged State=TestExecutionStarted, InProgress=False
[14.05.18 15:12:51 Diagnostic] RunSettings Content:

<RunSettings>
  <RunConfiguration>
    <TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
    <ResultsDirectory>C:\Source\Workspaces\QA\
     Opus3TestAutomation\TestResults</ResultsDirectory>
    <SolutionDirectory>C:\Source\Workspaces\QA\Opus3TestAutomation\ 
    </SolutionDirectory>
    <TargetPlatform>X86</TargetPlatform>
  </RunConfiguration>
  <MSTest>
    <SettingsFile>C:\Source\Workspaces\QA\Opus3TestAutomation\
     Opus3TestAutomation.testsettings</SettingsFile>
    <ForcedLegacyMode>true</ForcedLegacyMode>
    <IgnoreTestImpact>true</IgnoreTestImpact>
  </MSTest>
</RunSettings>

[14.05.18 15:12:51 Diagnostic] Final RunSettings for the current TestRunCriteria:

<RunSettings>
  <RunConfiguration>
    <TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
    <ResultsDirectory>C:\Source\Workspaces\QA\
     Opus3TestAutomation\TestResults</ResultsDirectory>
    <SolutionDirectory>C:\Source\Workspaces\QA\Opus3TestAutomation\
    </SolutionDirectory>
    <TargetPlatform>X86</TargetPlatform>
    <CollectSourceInformation>False</CollectSourceInformation>
  </RunConfiguration>
  <MSTest>
    <SettingsFile>C:\Source\Workspaces\QA\
     Opus3TestAutomation\Opus3TestAutomation.testsettings</SettingsFile>
    <ForcedLegacyMode>true</ForcedLegacyMode>
    <IgnoreTestImpact>true</IgnoreTestImpact>
  </MSTest>
</RunSettings>

[14.05.18 15:12:53 Warning] Warning : A testsettings file or a runsettings with a ForcedLegacyMode set to true is not supported with the MSTest V2 Adapter.
[14.05.18 15:12:53 Warning] No test is available in C:\Source\Workspaces\QA\Opus3TestAutomation\FlowTests\bin\Debug\FlowTests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[14.05.18 15:12:53 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=OperationSetFinished, operationInProgress=False
[14.05.18 15:12:53 Diagnostic] TestDiscoveryStats.OperationStateChanged State=OperationSetFinished, InProgress=False
[14.05.18 15:12:53 Diagnostic] ***    Run finished using 'InMemoryUnitTestWriter' ***
[14.05.18 15:12:53 Informational] ========== Run test finished: 0 run (0:00:02,1963655) ==========
[14.05.18 15:12:53 Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionFinished, operationInProgress=False
[14.05.18 15:12:53 Diagnostic] TestDiscoveryStats.OperationStateChanged State=TestExecutionFinished, InProgress=False

显然,VS 没有找到任何测试,即使测试资源管理器中列出了这些测试。

似乎这,或类似的,是不时更新的问题; 我已经看到它在更新后至少在 VS 2015 和 2017 中提到过。 不过,我还没有找到合理的解决方案。 而且为了能够做一些像运行我的单元测试一样基本的事情,不得不在 2017 旁边安装 VS 2015 是非常烦人的。

(顺便说一句,有没有人知道 MS 在发布 VS 更新之前是否真的进行了任何测试?似乎这样的错误(如果它确实是一个错误)如果你有半个 qa 应该很难不被发现部门)

更新:

  1. 这与我是在 Debug 还是 Release 中运行测试无关。

  2. 这条线被认为是一个潜在的原因:
    [15.05.18 09:47:23 警告] 警告:MSTest V2 适配器不支持测试设置文件或将 ForcedLegacyMode 设置为 true 的运行设置。

但是,这是警告而不是错误。 删除它没有任何影响。

此外,正在使用的 testsettings 文件是完全默认/空的,并且没有指定参数或参数。 此外,如果我想从命令行运行我的测试,这个文件在解决方案中是必需的,我必须这样做,因为我使用 Excel 工作表来运行和记录测试运行。 但是,在 VS 测试资源管理器中运行测试时会出现此问题; 在最新的 VS 2017 更新中,我什至还没有从命令行运行它们。

  1. 我现在正在运行 VS 2015 和 2017,具有完全相同且未更改的解决方案版本。 在这里,一切正常。

我也见过这个,以下对我有用:

  • 创建一个名为 test.runsettings 的新解决方案文件 (XML)(您可以将“test”替换为任何内容,只要保留扩展名“runsettings”)。
  • 此处的示例代码复制到文件中。
  • 节省。 干净的。 重建。 重启VS。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM