我在"运行功能测试"中遇到以下错误RELEASE任务期间的任务。
我正在尝试使用.Net 4.6.1 C#(VS2015.Update2)编写的内置VS .net测试框架来运行单元测试dll
在VM上运行测试的原因是针对不能使用的方案 托管测试代理
方案
Azure VM UnitTests dll
发布任务
Visual Studio测试代理部署(成功)
Azure文件复制(成功)
运行功能测试(失败)
LOG
> 2016-04-14T01:42:49.2222367Z Executing the powershell script:
> C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\RunVisualStudioTestsusingTestAgent\1.0.32\RunDistributedTests.ps1
> 2016-04-14T01:42:50.5719493Z ##[debug]Entering script
> RunDistributedTests.ps1 2016-04-14T01:42:50.5749473Z
> ##[debug]TestMachineGroup = xxxx.australiaeast.cloudapp.azure.com
> 2016-04-14T01:42:50.5759489Z ##[debug]Test Drop Location =
> C:\AcceptanceTests\SampleWebApiE2ERelease 2016-04-14T01:42:50.5759489Z
> ##[debug]Source Filter = bin\Release\AcceptanceTest.dll 2016-04-14T01:42:50.5769483Z ##[debug]Test Filter Criteria =
> 2016-04-14T01:42:50.5779473Z ##[debug]RunSettings File =
> C:\a\2c16ad4c2\CI Build\drop\AcceptanceTest\AcceptanceTest.runsettings
> 2016-04-14T01:42:50.5779473Z ##[debug]Build Platform =
> 2016-04-14T01:42:50.5789483Z ##[debug]Build Configuration =
> 2016-04-14T01:42:50.5789483Z ##[debug]CodeCoverage Enabled = false
> 2016-04-14T01:42:50.5799482Z ##[debug]TestRun Parameters to override =
> 2016-04-14T01:42:50.5799482Z ##[debug]TestConfiguration =
> 2016-04-14T01:42:50.5829484Z ##[debug]Application Under Test Machine
> Group = 2016-04-14T01:42:50.6079488Z ##[debug]Loading module from
> path
> 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.dll'.
> 2016-04-14T01:42:50.6479489Z ##[debug]Importing cmdlet
> 'Complete-Task'. 2016-04-14T01:42:50.6489487Z ##[debug]Importing
> cmdlet 'Get-LocalizedString'. 2016-04-14T01:42:50.6499484Z
> ##[debug]Importing cmdlet 'Set-TaskVariable'. 2016-04-14T01:42:50.6499484Z ##[debug]Importing cmdlet
> 'Set-TaskProgress'. 2016-04-14T01:42:50.6509481Z ##[debug]Importing
> cmdlet 'Add-TaskIssue'. 2016-04-14T01:42:50.6509481Z
> ##[debug]Importing cmdlet 'Write-TaskDetail'. 2016-04-14T01:42:50.6519486Z ##[debug]Importing cmdlet 'Find-Files'.
> 2016-04-14T01:42:50.6719494Z ##[debug]Loading module from path
> 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll'.
> 2016-04-14T01:42:51.1184496Z ##[debug]Importing cmdlet
> 'Add-BuildAttachment'. 2016-04-14T01:42:51.1194518Z ##[debug]Importing
> cmdlet 'Convert-String'. 2016-04-14T01:42:51.1204518Z
> ##[debug]Importing cmdlet 'Get-IndexedSourceFilePaths'. 2016-04-14T01:42:51.1204518Z ##[debug]Importing cmdlet
> 'Get-JavaDevelopmentKitPath'. 2016-04-14T01:42:51.1214490Z
> ##[debug]Importing cmdlet 'Get-MSBuildLocation'. 2016-04-14T01:42:51.1214490Z ##[debug]Importing cmdlet
> 'Get-ServiceEndpoint'. 2016-04-14T01:42:51.1224478Z ##[debug]Importing
> cmdlet 'Get-TfsClientCredentials'. 2016-04-14T01:42:51.1224478Z
> ##[debug]Importing cmdlet 'Get-ToolPath'. 2016-04-14T01:42:51.1234489Z ##[debug]Importing cmdlet 'Get-TaskVariable'. 2016-04-14T01:42:51.1234489Z ##[debug]Importing cmdlet
> 'Get-VisualStudioPath'. 2016-04-14T01:42:51.1244823Z
> ##[debug]Importing cmdlet 'Get-VssConnection'. 2016-04-14T01:42:51.1244823Z ##[debug]Importing cmdlet 'Invoke-Ant'.
> 2016-04-14T01:42:51.1255789Z ##[debug]Importing cmdlet
> 'Invoke-BatchScript'. 2016-04-14T01:42:51.1255789Z ##[debug]Importing
> cmdlet 'Invoke-Maven'. 2016-04-14T01:42:51.1266037Z ##[debug]Importing
> cmdlet 'Invoke-MSBuild'. 2016-04-14T01:42:51.1266037Z
> ##[debug]Importing cmdlet 'Invoke-PublishSymbols'. 2016-04-14T01:42:51.1276045Z ##[debug]Importing cmdlet 'Invoke-Tool'.
> 2016-04-14T01:42:51.1276045Z ##[debug]Importing cmdlet
> 'Invoke-VSTest'. 2016-04-14T01:42:51.1286046Z ##[debug]Importing
> cmdlet 'Publish-BuildArtifact'. 2016-04-14T01:42:51.1286046Z
> ##[debug]Importing cmdlet 'Copy-BuildArtifact'. 2016-04-14T01:42:51.1296014Z ##[debug]Importing cmdlet
> 'Add-BuildArtifactLink'. 2016-04-14T01:42:51.1296014Z
> ##[debug]Importing cmdlet 'Register-XamarinLicense'. 2016-04-14T01:42:51.1306047Z ##[debug]Importing cmdlet
> 'Unregister-XamarinLicense'. 2016-04-14T01:42:51.1306047Z
> ##[debug]Importing cmdlet 'Get-X509Certificate'. 2016-04-14T01:42:51.3085527Z ##[debug]Loading module from path
> 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.DTA\Microsoft.TeamFoundation.DistributedTask.Task.DTA.dll'.
> 2016-04-14T01:42:51.4288417Z ##[debug]Importing cmdlet
> 'Invoke-DeployTestAgent'. 2016-04-14T01:42:51.4298713Z
> ##[debug]Importing cmdlet 'Invoke-RunDistributedTests'. 2016-04-14T01:42:51.4318712Z ##[debug]Getting the connection object
> 2016-04-14T01:42:51.6626731Z ##[debug]UnregisterTestAgent script Path
> = 2016-04-14T01:42:51.6626731Z ##[debug]Calling Invoke-RunDistributedTests 2016-04-14T01:42:51.7435357Z
> ##[debug]Invoking Run Distributed Tests with Register Environment support 2016-04-14T01:42:52.5708848Z ##[warning]For troubleshooting,
> refer http://aka.ms/remotevstest. 2016-04-14T01:42:52.6509473Z
> ##[error]System.InvalidOperationException: Unable to get teamfoundation Collection Uri. Contact your administrator for more
> information. 2016-04-14T01:42:52.6519461Z ##[error] at
> Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.RunTests.Run()
> 2016-04-14T01:42:52.6529465Z ##[error] at
> Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.TaskRunner.Run(Dictionary`2
> arguments, VssConnection connection, TaskType taskType)
> 2016-04-14T01:42:52.6529465Z ##[error] at
> Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.RundistributedTestsCmdLet.ProcessRecord()
更新 - 添加了屏幕截图
更新2 - 更多详情
Azure VM不在域中,而是在WORKGROUP中
更新3 - 作为构建任务重新创建
我用一个任务创建了一个新的BUILD"运行功能测试"。 发生了类似的错误。
构建完整日志
2016-04-19T21:51:19.2143997Z Entering OnPrepareEnvironment
2016-04-19T21:51:19.2613857Z Primary repository: SampleWebApiE2ERelease
2016-04-19T21:51:19.2643916Z Calculating build folder hash key.
2016-04-19T21:51:19.2683854Z Loading tracking config if exists: C:\a\SourceRootMapping\0898c6c5-1b24-4adf-945a-6859faaaf010\8\SourceFolder.json
2016-04-19T21:51:19.2703915Z Creating new tracking config.
2016-04-19T21:51:19.2719613Z Loading top-level tracking config if exists: C:\a\SourceRootMapping\Mappings.json
2016-04-19T21:51:19.2752569Z Writing config to file: C:\a\SourceRootMapping\Mappings.json
2016-04-19T21:51:19.3362720Z Writing config to file: C:\a\SourceRootMapping\0898c6c5-1b24-4adf-945a-6859faaaf010\8\SourceFolder.json
2016-04-19T21:51:19.3452728Z Checking if artifacts directory exists: C:\a\1\a
2016-04-19T21:51:19.3452728Z Creating artifacts directory.
2016-04-19T21:51:19.3462731Z Checking if test results directory exists: C:\a\1\TestResults
2016-04-19T21:51:19.3472726Z Creating test results directory.
2016-04-19T21:51:19.3482737Z Creating binaries directory.
2016-04-19T21:51:19.3482737Z Setting local variables.
2016-04-19T21:51:19.3492744Z Create the initial timeline records for the tasks
2016-04-19T21:51:19.3512737Z Preparing repositories
2016-04-19T21:51:19.3522741Z repo clean = False
2016-04-19T21:51:19.3522741Z Found 2 endpoints to consider
2016-04-19T21:51:19.3692726Z Found 1 repositories to sync
2016-04-19T21:51:19.3822789Z Starting: Get sources
2016-04-19T21:51:19.3872730Z build.fetchtags=false
2016-04-19T21:51:19.3922753Z Entering GitSourceProvider.PrepareRepositoryAsync
2016-04-19T21:51:19.3932745Z Repository type=TfsGit
2016-04-19T21:51:19.3932745Z localPath=C:\a\1\s
2016-04-19T21:51:19.3942746Z clean=False
2016-04-19T21:51:19.3942746Z sourceBranch=refs/heads/master
2016-04-19T21:51:19.3952739Z sourceVersion=60e5e7f72e94016da7c2de37c839a015656f803c
2016-04-19T21:51:19.3952739Z Syncing repository: SampleWebApiE2ERelease (Git)
2016-04-19T21:51:19.3962739Z repository url=https://*******.visualstudio.com/DefaultCollection/_git/SampleWebApiE2ERelease
2016-04-19T21:51:19.3982738Z checkoutSubmodules=False
2016-04-19T21:51:19.6062900Z Starting clone
2016-04-19T21:51:21.3684519Z Checking out 60e5e7f72e94016da7c2de37c839a015656f803c to C:\a\1\s
2016-04-19T21:51:21.5500305Z Checked out branch refs/heads/master for repository SampleWebApiE2ERelease at commit 60e5e7f72e94016da7c2de37c839a015656f803c
2016-04-19T21:51:21.5510565Z Leaving GitSourceProvider.PrepareRepositoryAsync
2016-04-19T21:51:21.5720503Z Leaving OnPrepareEnvironment
2016-04-19T21:51:21.7216514Z Running tasks
2016-04-19T21:51:21.7586505Z Starting task: Run Tests bin\Release\AcceptanceTest.dll on *************************.australiaeast.cloudapp.azure.com
2016-04-19T21:51:21.9697226Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.98.1\tasks\RunVisualStudioTestsusingTestAgent\1.0.33\RunDistributedTests.ps1
2016-04-19T21:51:22.3211330Z ##[debug]Entering script RunDistributedTests.ps1
2016-04-19T21:51:22.3241378Z ##[debug]TestMachineGroup = *************************.australiaeast.cloudapp.azure.com
2016-04-19T21:51:22.3251318Z ##[debug]Test Drop Location = C:\AcceptanceTests\SampleWebApiE2ERelease
2016-04-19T21:51:22.3251318Z ##[debug]Source Filter = bin\Release\AcceptanceTest.dll
2016-04-19T21:51:22.3261325Z ##[debug]Test Filter Criteria =
2016-04-19T21:51:22.3271314Z ##[debug]RunSettings File = C:\AcceptanceTests\SampleWebApiE2ERelease\AcceptanceTest.runsettings
2016-04-19T21:51:22.3271314Z ##[debug]Build Platform =
2016-04-19T21:51:22.3281422Z ##[debug]Build Configuration =
2016-04-19T21:51:22.3291320Z ##[debug]CodeCoverage Enabled = false
2016-04-19T21:51:22.3291320Z ##[debug]TestRun Parameters to override =
2016-04-19T21:51:22.3301320Z ##[debug]TestConfiguration =
2016-04-19T21:51:22.3321302Z ##[debug]Application Under Test Machine Group =
2016-04-19T21:51:22.3531325Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.98.1\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.dll'.
2016-04-19T21:51:22.3681296Z ##[debug]Importing cmdlet 'Complete-Task'.
2016-04-19T21:51:22.3681296Z ##[debug]Importing cmdlet 'Get-LocalizedString'.
2016-04-19T21:51:22.3691292Z ##[debug]Importing cmdlet 'Set-TaskVariable'.
2016-04-19T21:51:22.3691292Z ##[debug]Importing cmdlet 'Set-TaskProgress'.
2016-04-19T21:51:22.3691292Z ##[debug]Importing cmdlet 'Add-TaskIssue'.
2016-04-19T21:51:22.3701295Z ##[debug]Importing cmdlet 'Write-TaskDetail'.
2016-04-19T21:51:22.3701295Z ##[debug]Importing cmdlet 'Find-Files'.
2016-04-19T21:51:22.3841314Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.98.1\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll'.
2016-04-19T21:51:22.3901295Z ##[debug]Importing cmdlet 'Add-BuildAttachment'.
2016-04-19T21:51:22.3901295Z ##[debug]Importing cmdlet 'Convert-String'.
2016-04-19T21:51:22.3911318Z ##[debug]Importing cmdlet 'Get-IndexedSourceFilePaths'.
2016-04-19T21:51:22.3911318Z ##[debug]Importing cmdlet 'Get-JavaDevelopmentKitPath'.
2016-04-19T21:51:22.3921318Z ##[debug]Importing cmdlet 'Get-MSBuildLocation'.
2016-04-19T21:51:22.3921318Z ##[debug]Importing cmdlet 'Get-ServiceEndpoint'.
2016-04-19T21:51:22.3931319Z ##[debug]Importing cmdlet 'Get-TfsClientCredentials'.
2016-04-19T21:51:22.3941311Z ##[debug]Importing cmdlet 'Get-ToolPath'.
2016-04-19T21:51:22.3941311Z ##[debug]Importing cmdlet 'Get-TaskVariable'.
2016-04-19T21:51:22.3951312Z ##[debug]Importing cmdlet 'Get-VisualStudioPath'.
2016-04-19T21:51:22.3951312Z ##[debug]Importing cmdlet 'Get-VssConnection'.
2016-04-19T21:51:22.3961310Z ##[debug]Importing cmdlet 'Invoke-Ant'.
2016-04-19T21:51:22.3961310Z ##[debug]Importing cmdlet 'Invoke-BatchScript'.
2016-04-19T21:51:22.3971305Z ##[debug]Importing cmdlet 'Invoke-Maven'.
2016-04-19T21:51:22.3971305Z ##[debug]Importing cmdlet 'Invoke-MSBuild'.
2016-04-19T21:51:22.3981310Z ##[debug]Importing cmdlet 'Invoke-PublishSymbols'.
2016-04-19T21:51:22.3981310Z ##[debug]Importing cmdlet 'Invoke-Tool'.
2016-04-19T21:51:22.3991312Z ##[debug]Importing cmdlet 'Invoke-VSTest'.
2016-04-19T21:51:22.3991312Z ##[debug]Importing cmdlet 'Publish-BuildArtifact'.
2016-04-19T21:51:22.4001333Z ##[debug]Importing cmdlet 'Copy-BuildArtifact'.
2016-04-19T21:51:22.4001333Z ##[debug]Importing cmdlet 'Add-BuildArtifactLink'.
2016-04-19T21:51:22.4011309Z ##[debug]Importing cmdlet 'Register-XamarinLicense'.
2016-04-19T21:51:22.4011309Z ##[debug]Importing cmdlet 'Unregister-XamarinLicense'.
2016-04-19T21:51:22.4011309Z ##[debug]Importing cmdlet 'Get-X509Certificate'.
2016-04-19T21:51:22.4141314Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.98.1\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.DTA\Microsoft.TeamFoundation.DistributedTask.Task.DTA.dll'.
2016-04-19T21:51:22.4351328Z ##[debug]Importing cmdlet 'Invoke-DeployTestAgent'.
2016-04-19T21:51:22.4361318Z ##[debug]Importing cmdlet 'Invoke-RunDistributedTests'.
2016-04-19T21:51:22.4381326Z ##[debug]Getting the connection object
2016-04-19T21:51:23.2196120Z ##[debug]UnregisterTestAgent script Path =
2016-04-19T21:51:23.2206119Z ##[debug]Calling Invoke-RunDistributedTests
2016-04-19T21:51:23.3495532Z ##[debug]Invoking Run Distributed Tests with Register Environment support
2016-04-19T21:51:23.5023828Z ##[warning]For troubleshooting, refer http://aka.ms/remotevstest.
2016-04-19T21:51:23.5171330Z ##[error]System.InvalidOperationException: Unable to get teamfoundation Collection Uri. Contact your administrator for more information.
2016-04-19T21:51:23.5181352Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.RunTests.Run()
2016-04-19T21:51:23.5191312Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.TaskRunner.Run(Dictionary`2 arguments, VssConnection connection, TaskType taskType)
2016-04-19T21:51:23.5201289Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.RundistributedTestsCmdLet.ProcessRecord()
2016-04-19T21:51:23.5669478Z Finishing task: RunVisualStudioTestsusingTestAgent
2016-04-19T21:51:23.5679492Z ##[error]System.Exception: Task RunVisualStudioTestsusingTestAgent failed. This caused the job to fail. Look at the logs for the task for more details.
2016-04-19T21:51:23.5689495Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)
2016-04-19T21:51:23.5719485Z Entering OnFinalizeJob
2016-04-19T21:51:23.5739469Z Leaving OnFinalizeJob
更新4
我更改了BUILD中的任务,以便完成任务;
NuGet Installer
Visual Studio Build
Visual Studio Test (unit tests)
Index Sources & Publish Symbols
Copy And Publish Build Artifacts
Azure File Copy
Visual Studio Test Agent Deployment
Run Functional Tests
"运行功能测试"工作
然后我从BUILD中删除了3个任务Azure文件复制,Visual Studio测试代理部署,运行功能测试,因为我不希望验证测试作为BUILD的一部分,而是作为RELEASE的一部分。
然后我改变了我的RELEASE任务,因此它们是;
Azure File Copy
Visual Studio Test Agent Deployment
Run Functional Tests
那很有效。
然后我禁用了Visual Studio Test Agent部署任务,因为代理现在部署在VM上,并且该任务需要一段时间才能运行。
失败了,似乎Run Functional Tasks需要先前的任务Visual Studio Test Agent Deployment。
这是运行功能测试的错误吗?您是否可以在已安装测试代理的情况下配置自己的VM?
答案 0 :(得分:3)
"运行功能测试"任务需要在“Visual Studio测试代理部署”任务之前。
“Visual Studio测试代理部署”任务将“测试代理”部署到所有计算机并自动配置它们以进行自动化运行。如果代理已在计算机上可用并已配置,则此任务将为无操作。
检查:https://github.com/Microsoft/vsts-tasks/tree/master/Tasks/RunDistributedTests