Azure Devops-UI测试无法在自托管代理上运行

时间:2020-01-30 12:11:00

标签: c# .net azure-devops yaml

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

Agent计算机已安装VS测试平台,还包含VS2017构建工具以运行编码的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'

1 个答案:

答案 0 :(得分:0)

将cmd.exe更改为以提升的特权运行,该特权总是在管理员解决问题后启动Agent.Listener。