1
votes

at First im New to automated Tests with TFS, so i try actual many Things with try on Error. But I Hope you can give me some Ideas What i perhaps do wrong.

I have set up a Environment in Microsoft Test Manager like described in serveral Blogs from MSDN. http://msdn.microsoft.com/en-us/library/hh873102.aspx#Prerequisites for example.

My Infrastructure is as follows: The Build Server and Test Controller are on the Same Machine (Win2012) but my Test Agent(Win2008R2) is an other Machine. Everything is TFS 2013 or VS 2013 Update 3.

I have a Build definition which builds the Tests on the Buildserver into a specified Dropfolder. This is working fine. And a Second Build Definition which uses the LabDefaultTemplate.11 for working with the Environment. Within i specified the Environment, the other Build Definiton a Deployment Script and also my Testplan with the associated Automated Tests.

But if i try to Start my Build-Deploy-Test Workflow i have got two outcomes. First, without specifed a Deploment Script the Workflow Reaches Test Run and the Workflow became endless (It runs 16 Hours) then i aborted it. And Second i specified the Deployment Script and now it seems i get the same but on the Deployment Step. I let it Run for almost 20 Minutes and i watched my Agent on VM Console. All i saw is that he sometimes Disconnected for a short moment and then was Online again.

Now I'm Asking, why this Build Workflow could becomes endless?

The Tests would be CodedUiTests.

Here the Log of the last Run i stopped:

20:37 Overall Build Process
20:37 Application Deployment Workflow
00:00 Update Build Number
00:00 Get Build Details
01:00 If Build is needed
01:00 Do Build
00:00 Start Build Workflow
01:00 Wait For Build To Complete
00:00 Set Build Location
00:00 Get Build Location And Build Number
00:00 Compute build location needed
00:00 Compute build path
00:00 If user selected stored environment
00:00 Get Lab Environment Uri
00:00 Get Lab Environment
00:00 If Restore Snapshot
00:00 No Clean Snapshot
00:00 If Virtual Environment
00:00 If deployment or test needed
00:00 Wait For Environment To Be Ready
19:36 If deployment needed
19:36 Do deployment
00:00 Reserve Environment For Deployment
19:36 Deploy Build on Environment
19:36 Deploying Build
19:36 Run Deployment scripts
19:36 Run Deployment Task Deployment Task Logs for Machine: Win2008R2   
00:00 Release Environment From Deployment

If you would need more specific informations please leave a Answer with the needed Things, and i will care about it, but i actual do not know what you could need and don't want to overfill this Question

Edit Dec 16th 2014:

Here the requested Details:

Deploying Build 00:30:00
Run Deployment scripts 00:30:00

Inputs
Values: Win2008R2TA02 | $(BuildLocation)\Uitest\deploymentScript.cmd $(BuildLocation)

Run Deployment Task00:30:00

Inputs
        UseRoleForDeployment: False
        MaxWaitTime: 00:30:00
        ThrowOnError: True
        BuildLocation: \\BuildServer\TFS Build\UiTest.Dev.Build\UiTest.Dev.Build_20141216.1
        LabEnvironmentUri: vstfs:///LabManagement/LabEnvironment/11
        DeploymentScriptDetails: Win2008R2TA02 | $(BuildLocation)\Uitest\deploymentScript.cmd $(BuildLocation)

The Deployment Script i found in the Internet, but i thought this could be working.

REM set build path
set buildlocation=%1

REM set deployment path
set targetdir="C:\deploy"

REM create deployment directory
if not exist %targetdir% (cmd /c mkdir %targetdir%)

REM copy build to the deployment directory
xcopy /c /y /e %buildlocation%\*.* %targetdir%

REM if you are using a deployment package you can run it here, after you copy it to your deployment directory

And i Call it as follows:

$(BuildLocation)\Uitest\deploymentScript.cmd $(BuildLocation)

In the Eventlog of the Test Controller there are some Errors Repeating while the Build is running: Service Control Managar:

The Visual Studio Test Controller service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 0 milliseconds: Restart the service.

.Net Runtime:

Application: QTController.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException Stack: at Microsoft.TeamFoundation.TestManagement.Controller.BuildDropDownloadManager.GetLocalSharePath(System.String) at Microsoft.VisualStudio.QualityTools.Controller.DeploymentTaskMonitor.IsUsingServerDrop(Microsoft.VisualStudio.TestTools.Execution.DeploymentTask) at Microsoft.VisualStudio.QualityTools.Controller.DeploymentTaskMonitor.ProvisionBuildSharePermision(Microsoft.VisualStudio.TestTools.Execution.DeploymentTask) at Microsoft.VisualStudio.QualityTools.Controller.DeploymentTaskMonitor.ProcessNewDeploymentTasks() at Microsoft.VisualStudio.QualityTools.Controller.DeploymentTaskMonitor.Poll(System.Object) at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart(System.Object)

I tried this solution but i does not helping and related to the Link i have no "Web Access" Folder to clear the Cache out. https://social.msdn.microsoft.com/Forums/vstudio/en-US/c1ba09a8-5b8a-4c6d-8635-83085593647b/tfs-2013-deploy-to-testlab-is-failing-labdefaulttemplate11?forum=tfsbuild

I realy stuck on that Problem. Any Help would be very appreciated.

2

2 Answers

1
votes

Ok, i found the issue. The problem was a corrupt Visual Studio and MTM Installation on the Buildserver where also the TestController is installed.

If you stumble on this problem, try the following things. - Are all Components on the same Version (in my case 2013 Update 3) Check also Agent and Controller (in it's Configuration Dialog you find a About Button) - open the MTM on the Server and Check if it can switch between different testplans of the project (in m case that bring up an error, and thats why the Controller could not deliver the Cases to the Agent.)

if it is like in my case so try a uninstallation and reinstallation of Visual Studio and MTM My order was to deinstall first MTM then VS after that install VS then MTM then the actual Update.

0
votes

The build report log on visual studio is not that great. Have you checked the log on the tfs website? (build failed report -> diagnostics -> view log or on the website under builds -> definition -> diagnostics)

Have you set the timeout for the deployment script? 16 hours is a long time. also can you link the deployment code to the script. Do you have any other tests that do run on the agent? Have you checked the login/password and deactivated the login screen on the agent because tfs has a problem accessing this.