【问题标题】:Azure Devops - UI tests fail to run on Self hosted agentAzure Devops - UI 测试无法在自托管代理上运行
【发布时间】:2020-05-16 01:16:34
【问题描述】:

尝试在 Azure 自托管代理上运行 Coded UI 测试时,出现以下错误

代理机器安装了 VS 测试平台,还包含 VS2017 构建工具来运行 Coded ui 测试。

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.TestPlatform.Core.ITestRunnerService.InitializeConnection(IEnumerable`1 pathToAdditionalExtensions, Boolean loadOnlyWellKnownExtensions)
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceProxy.InitializeConnection(IEnumerable`1 pathToAdditionalExtensions, Boolean loadOnlyWellKnownExtensions)
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.TestConnection(Binding binding, EndpointAddress address, TestRunnerServiceProxy& proxy, Exception& exceptionDuringConnection)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.InitializeProxy()
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.Initialize_NoLock(Boolean forceX86Discoverer)
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.EnsureInitialized(Boolean forceX86Discoverer, Boolean shouldCheckForRelaunch)
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.InvokeTestRunnerServiceAction(Boolean forceX86Discoverer, Action`1 action)
   at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.DiscoverTests(IEnumerable`1 sources, String settings, Int64 frequencyOfDiscoveredTestEvent, ITestCaseDiscoveryLog testCaseDiscoveryLog, TimeSpan discoveredTestEventTimeout)
   at Microsoft.VisualStudio.TestPlatform.Client.Rocksteady.RocksteadyDiscoveryManager.DiscoverTestsForTestRun(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler eventHandler)
   at Microsoft.VisualStudio.TestPlatform.Client.DiscoveryRequest.Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest.DiscoverAsync()
   at Microsoft.VisualStudio.TestService.VstestAdapter.DiscoverTests.PerformDiscovery(TestAutomationRunSlice sliceDetails, IAddTestCasesToTcmRunHandler addTestCasesToTcmRunHandler, ExecutionStateContext stateModelContext)
   at Microsoft.VisualStudio.TestService.VstestAdapter.Execution.FetchPreviousPhaseData(ExecutionStateContext stateModelContext)
   at Microsoft.VisualStudio.TestService.VstestAdapter.ExecutionAndPublish.Run(ExecutionStateContext stateModelContext, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()<---

##[error]TestExecution encountered unexpected failures System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.TestPlatform.Common.TestRunner.TestPlatformException: Failed to initialize client proxy: could not connect to test process vstest.discoveryengine.x86.exe. ---> System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://machineA/vstest.discoveryengine/15248 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

具体来说,失败的任务是 Visual Studio 测试任务 (VSTest@2)。紧接该步骤之前,有一个 Visual Studio 测试平台安装程序任务 (VisualStudioTestPlatformInstaller@1),该任务设置为针对 nuget 提供的最新测试平台。

CodedUI 测试正在使用 VS2017 构建。

这些是 yaml 任务:

  - task: VisualStudioTestPlatformInstaller@1
    displayName: 'Visual Studio Test Platform Installer'
    inputs:
      versionSelector: latestStable


  - task: VSTest@2
    displayName: 'CodedUI Tests'
    inputs:
      testSelector: 'testPlan'
      testPlan: '8369'
      testSuite: '8373'
      testConfiguration: '13'
      searchFolder: 'C:\Testing\bin\Tests'
      uiTests: true
      runSettingsFile: 'C:\Testing\bin\Tests\Solution Items\OurTestSettings.testsettings'
      runTestsInIsolation: true
      testRunTitle: 'Nightly Tests'

【问题讨论】:

  • We can't really help you with just a stacktrace,考虑使用失败的代码编辑您的问题。
  • 您好,使用 yaml 创建了一个管道,但在运行配置的测试时任务失败。没有编写代码,它的 Azure Devops 管道。
  • 至少我们需要看看你的测试方法代码是什么......

标签: c# .net azure-devops yaml


【解决方案1】:

将 cmd.exe 更改为以提升的权限运行,始终以管理员身份启动 Agent.Listener 解决了问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-14
    • 2021-03-17
    • 1970-01-01
    • 2020-12-24
    • 1970-01-01
    • 2019-08-31
    • 2021-03-08
    • 2019-11-06
    相关资源
    最近更新 更多