Showing posts with label tfs 2010. Show all posts
Showing posts with label tfs 2010. Show all posts

Wednesday, August 8, 2012

TFS 2012 RC - Test Controller is shown as offline

If you go to Microsoft Test Manager->Lab Center->Controllers and see the Test Controller as offline, check the event logs on the same machine.
If you see the below error:
The description for Event ID 0 from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer
or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
(mtm.exe, PID 2968, Thread 13) ControllerConnectionManager : InternalConnect : System.Net.Sockets.SocketException (0x80004005): The requested name is valid,
but no data of the requested type was found
Server stack trace:
   at System.Net.Dns.GetAddrInfo(String name)
   at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
   at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
   at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream,

ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

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.TestTools.Execution.IControllerAccessManager.get_ControllerVersion()
   at Microsoft.VisualStudio.TestTools.Execution.ExecutionUtilities.GetControllerVersion(IControllerAccessManager accessManager, Boolean

tolerateOldControllers)
   at Microsoft.VisualStudio.TestTools.Controller.ControllerConnectionManager.InternalConnect(ControllerConnectionInfo controllerConnectionInfo)

the message resource is present but the message is not found in the string/message table

Find out the exact machine name for the test controller by running the following query:
USE [Tfs_DefaultCollection]
GO

SELECT [PartitionId]
      ,[InternalId]
      ,[Name]
      ,[Description]
      ,[GroupId]
      ,[LastHeartbeat]
  FROM [dbo].[tbl_TestController]
GO


Then make sure that you are able to ping the full computer name which is present in the [Name] column (exclude the port number) .
The issue I was facing was that I was able to ping the computer name but not the full computer name. Once you are able to ping the full computer name, reconfiguring the test controller should fix the issue.

Thursday, July 19, 2012

TFS 2010 - How to fix the issue with automated tests getting aborted in Test Manager

I had been running all my tests for a long time using Build-Deploy-Test workflow (http://social.technet.microsoft.com/wiki/contents/articles/tfs-2010-build-deploy-test.aspx)

Suddenly one day, the test runs started getting aborted and there was no specific log which pointed to the root cause.

To find the root cause, I ran all the tests locally from Visual Studio and tried to publish the results against a build from the Test Results window.

The publish failed with the error:
Failed Invalid character in Assert.AreEqual failed. Expected:xxx Actual:yyy

The problem was that xxx and yyy had some invalid characters which was causing the publish to fail. I fixed the test by comparing expected and actual and doing Assert.Fail() if they didn't match. Thus, the invalid characters were not logged to console and the publish started to succeed.

Problem solved and the test runs started getting completed.

Thursday, March 29, 2012

TFS 2010 Build - Not enough storage is available to complete this operation

If you see the below error while building your projects on the build agents:
Not enough storage is available to complete this operation

The reason could be that the build agent machine is running out of memory.
Increasing the RAM on the build agnet machine should fix the issue. 

Friday, March 23, 2012

TF215097: An error occurred while initializing a build for build definition xxx: There is not enough space on the disk.

If you see the below error:

TF215097: An error occurred while initializing a build for build definition xxx: There is not enough space on the disk.
 
Please follow the below steps:

  • Go to Start->Programs->Microsoft Team Foundation Server 2010->Team Foundation Administration Console
  • Select a build agent and click Properties
  • Change the working directory from to $(SystemDrive) to D:, E: etc depending upon the free disk drive

 

Monday, March 19, 2012

TFS 2010 Gated Checkin - TF14098: Access Denied: User xxx needs Checkin, CheckinOther permission(s)

If you have enabled Gated Checkin on your souce tree, you would have seen the following properties in the build alert email:
  • Checked in on behalf of
  • Checked in by
The value for "Checked in by" is the account under which the build agent is running. The value for "Checked in on behalf of" is the user who actually checked in the changes which triggered the Gated Checkin.

If you recieve this below error during gated checkin:
TF14098: Access Denied: User xxx needs Checkin, CheckinOther permission(s) for $/TeamProject/xxx/abc.cs.

The reason is that the build agent account doesn't have permission on your source tree to checkin other user's changes

Wednesday, February 22, 2012

TFS 2010 - Microsoft.TeamTest.targets(14,5): Object reference not set to an instance of an object

While trying to build unit test projects, you might have seen this error intermittently
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamTest\Microsoft.TeamTest.targets(14,5): error : Object reference not set to an instance of an object.

To fix this issue, you should look at the warnings which you get while building this project. Even though they are not errors, these warnings could be the cause of intermittent failure. So try to fix the warnings and this should resolve the issue.

If this does not work, another fix is described at http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/bb0a1752-f6ce-4001-8b45-5aa72f1909e3

These steps need to followed:
  • Open the build definition
  • Go to Process tab
  • Select Logging Verbosity as Detailed

Tuesday, October 25, 2011

TFS 2010 Gated Checkin - Reconcile workspace after reboot

Normally when you checkin your changes with Gated Checkin enabled, once the files are checked in you see a "Team Foundation Build Notification" pop up to reconcile the workspace.
However, condiser you checkin something at the end of the day and go home thinking that you will reconcile the next day. In the mean time, your system got rebooted or went outside of network. The next day when you login to your system, you dont see the "Team Foundation Build Notification" pop up to reconcile the workspace.
You dont have to wait for the pop-up and can do the following:
  • Open the Build result of your Gated Checkin by double clicking on the Gated Checkin Build Definition in Team Explorer->Team Project->Builds
  • Click Reconcile Workspace


Thursday, October 20, 2011

TFS 2010 - Lab Build Definition appends the configuration to build output path $(BuildLocation)

Consider you have two build definitions:
  • DailyBuild - Uses DefaultTemplate.xaml
  • CIBuild - Uses LabDefaultTemplate.xaml
If you do not specify any configurations explicitly in DailyBuild, the CIBuild would work fine and you will be able to run the Build-Deploy-Test workflow smoothly.

However, as soon as you explicitly specify a configuration in DailyBuild, the CIBuild would start failing because it wont be able to find the binaries in the build drop.
This is because it appends the configuration to build output path in $(BuildLocation)

The solution is to modify the LabDefaultTemplate.xaml
Before:
<If Condition="[LabWorkflowParameters.BuildDetails.IsTeamSystemBuild = True]" DisplayName="Compute build location needed" sap:VirtualizedContainerService.HintSize="858,201">
       <If.Then>
         <Assign DisplayName="Compute build path" sap:VirtualizedContainerService.HintSize="291,100">
           <Assign.To>
             <OutArgument x:TypeArguments="x:String">[BuildLocation]</OutArgument>
           </Assign.To>
           <Assign.Value>
             <InArgument x:TypeArguments="x:String">[If(LabWorkflowParameters.BuildDetails.Configuration Is Nothing, BuildLocation, If(LabWorkflowParameters.BuildDetails.Configuration.IsEmpty Or (SelectedBuildDetail.Information.GetNodesByType(Microsoft.TeamFoundation.Build.Common.InformationTypes.ConfigurationSummary, True)).Count = 1, BuildLocation, If(LabWorkflowParameters.BuildDetails.Configuration.IsPlatformEmptyOrAnyCpu, BuildLocation + "\" + LabWorkflowParameters.BuildDetails.Configuration.Configuration, BuildLocation + "\" + LabWorkflowParameters.BuildDetails.Configuration.Platform + "\" + LabWorkflowParameters.BuildDetails.Configuration.Configuration)))]</InArgument>
           </Assign.Value>
         </Assign>
       </If.Then>
     </If>
 After:
 <If Condition="[LabWorkflowParameters.BuildDetails.IsTeamSystemBuild = True]" DisplayName="Compute build location needed" sap:VirtualizedContainerService.HintSize="858,201">
       <If.Then>
         <Assign DisplayName="Compute build path" sap:VirtualizedContainerService.HintSize="291,100">
           <Assign.To>
             <OutArgument x:TypeArguments="x:String">[BuildLocation]</OutArgument>
           </Assign.To>
           <Assign.Value>
             <InArgument x:TypeArguments="x:String">[BuildLocation]</InArgument>
           </Assign.Value>
         </Assign>
       </If.Then>
     </If>

Friday, September 23, 2011

TFS 2010 - There was no endpoint listening at http://buildagent:9191/Build/v3.0/Services/Controller/1 that could accept the message

Sometimes the build agent stops working all of a sudden and you see the error:
There was no endpoint listening at http://buildagent:9191/Build/v3.0/Services/Controller/1 that could accept the message

This could occur because of incorrect proxy being set. If you uncheck the below checkbox or correct the proxy, it should fix the issue.

















The other fix for this is to unregister the Build Services and Register it again. Below are the steps:
  • Open Team Foundation Administration console
  • Go to Build Configuration
  • Click "Unregister" link on the build service
  • Click "Register" link on the build service
  • Specify the "Team Project Collection" and "Credentials" and Save

Monday, September 12, 2011

TFS 2010 Lab Management - There are no test cases matching the criteria specified

Have you seen the below error while running the Build-Deploy-Test worklow using Lab Managemnt in TFS 2010. "There are no test cases matching the criteria specified. Use Microsoft Test Manager to view the test cases."

Following are the possible causes for this error:
  • You are not building the test projects in the Build. Hence the test binaries are missing in TestDirectory.
  • You have not selected the correct Test Plan or Test Suite in the Test section of the Lab Build Definition which has the automated test cases .
  • The Test Confirugation selected in the Test section of the Lab Build Definition does not match the Configuration selected for the automated test case in Microsoft Test Manager.

Tuesday, August 23, 2011

TFS 2010 - The process cannot access the file 'data.coverage' because it is being used by another process

Have you came across a situation where your build is running indefinitely and when you see stop the build, the following error is thrown:

The process cannot access the file 'data.coverage' because it is being used by another process.

This happens only when code coverage is enabled in the testsettings being used in the build. Also, you will see this issue if one of your unit tests is having an issue. To know about the root cause of the issue with the unit test, you can do the following:
  • Go to the build agent box
  • Browse to the directory where the build agent "Sources", "Binaries" and "Test Results" folder are present
  • Open the trx file in the "Test Results" folder
  • Click on "Test run error"
You will see the exact cause of the issue here.

Also, if you dont want to Stop the build forcefully and allow it to finish the execution, please follow these steps:
  • Go to the build agent box
  • Go to Task Manager and kill the process "VSPerfMon.exe"
This will allow the build to complete gracefully but you will not see any unit test and code coverage results.

Tuesday, July 12, 2011

TFS 2010 - Build fails with error " Read permission is required to retrieve the content"

When the build fails with the below error, what does it mean:
TF215097: An error occurred while initializing a build for build definition \TeamProject\BuildDef: TF204001: The item $/TeamProject/BuildProcessTemplates/DefaultTemplate.xaml cannot be downloaded. Read permission is required to retrieve the content.
It means that the service account under which the build agent is running needs read access to the source control.

Sunday, June 19, 2011

TFS 2010 - Unable to stop build

I came across an issue where a build was stuck for days with the message:
There was no endpoint listening at http://machinename:9191/Build/v3.0/Services/Agent/282 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

When I tried to stop the build, I was shown the error:
TF215104: Failed to stop build: it did not respond to a workflow cancellation request." When I went to the build agent and tried to delete the agent, I was shown the error:
Cannot remove build agent from build controller because it is currently reserved for a build

I unregistered the build service, tried to stop the build, registered the build service again and kept repeating the steps multiple times. I finally had luck and the build was stopped.
I registered the build service again and everything was smooth.

If you have write access to the TFS Warehouse, you can delete the build agent by following the steps at http://sleepcanwait.blogspot.com/2010/07/cannot-remove-build-agent-from-build.html 

Saturday, June 18, 2011

TFS 2010 Test Controller - Disk runs out of space

You must have observed that the disk on test controller runs out of space pretty fast. This is because of the files being stored in localappdata%\VSEQT\QTController\TestRunStorage which never get deleted. There are two options:

Option1:
Add a key ControllerJobSpooling in \Microsoft Visual Studio 10.0\Common7\IDE\QTController.exe.config and set its value to false. Then restart the test controller service.
Also refer http://blogs.msdn.com/b/shivash/archive/2011/01/21/using-visual-studio-test-controller-with-mtm-and-disk-out-of-space-issues.aspx

Option2:
Create a batch file with this command:
rmdir /s /q "C:\Users\<serviceaccount>\AppData\Local\VSEQT\QTController"
Then create a scheduled task which calls this batch file at regular intervals.

Monday, May 23, 2011

TFS 2010 - Associate existing test cases with test methods

If you want to create new test cases which are associated with test methods, tcm.exe will solve your purpose.
However, what if you want to associate existing test cases with test methods.
Here is the thread on MSDN forum which poinst out how to associate existing test cases with test methods http://social.msdn.microsoft.com/Forums/en-US/vsmantest/thread/774642af-fa44-473d-ab6d-817cfa83cf10/

Sunday, March 27, 2011

TFS 2010 - hexadecimal value 0x07 is an invalid character

I recently encountered an issue where my tests in lab management were getting aborted. I really had a hard time figuring out what was really going wrong. I looked into the test run log in the Test Manager->Analyze Test Runs but nothing obvious showed up. I also enabled diagnostic logging in my lab build definition but again nothing showed up.
I then used tcm.exe and created a new test run using "tcm run /create". Then I executed the run using "tcm run /execute" and I got the error: "hexadecimal value 0x07 is an invalid character"
Then I looked into the intellitrace logs in "%localappdata%"\VSEQT\QTController. Here I found that there was an invalid xml in my Assert statement.
Fixing the xml in the Assert solved my problem.

Tuesday, March 8, 2011

TFS 2010 Build: Keep folder tree structure

There are two approaches :
=============================================
Approach 1
=============================================

To keep the output structure, you have to make TFSBuildHost not pass OutDir
to MSBuild and  custom the output path of each project.
  1. Open the build process file, navigate to Compile the Project Sequence, edit the property of Run MSBuild for Project Activity.
    • Set OutDir to empty (just make the textbox is empty)
    • set CommandLineArguments to String.Format("/p:SkipInvalidConfigurations=true {0} /p:TeamBuildOutDir=""{1}""", MSBuildArguments, outputDirectory)
  2. Modify each project file in the solution.
    • Check out project file to Edit.
    • Open project file  with notepad.
    • Find <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    • Use following code to replace the default OutputPath Property.
                   <OutputPath Condition=" '$(TeamBuildOutDir)'=='' ">bin\release\</OutputPath>
                   <OutputPath Condition=" '$(TeamBuildOUtDir)'!='' ">$(TeamBuildOutDir)\<ProjectName>\</OutputPath>
                  The word “Release|AnyCPU” is dependent on the value of “ConfigrationToBuild”  in   TFSBuild.proj.      
    • Save project file and check in.
=============================================
Approach 2
=============================================
  1. Open the build process file, navigate to Compile the Project Sequence, edit the property of Run MSBuild for Project Activity.
  2. Set OutDir to empty (just make the textbox is empty)
  3. Set OutDir to System.IO.Path.Combine(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(localProject))
  4. In the build definition, instead of specifying a single solution, specify the projects individually