Monday, March 5, 2012

Enabling logging on MSTest.exe

Many times you might need to enable verbose logging on MSTest.exe to debug the Test related issue on the build machine.

Here are the steps

Step 1: Find the MSTest.exe.config file on the build machine. It can be found at the following location
<Drive:>\Program Files\Microsoft Visual Studio 10.0\Common7\IDE

Step 2: Make a backup copy of MSTest.exe.config file

Step 3: Add the following <system.diagnostics> in the MSTest.exe.config file
<system.diagnostics>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="EqtListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Temp\MSTestTrace.log" />
      </listeners>
    </trace>
    <switches>
      <add name="EqtTraceLevel" value="Verbose" />
    </switches>
  </system.diagnostics>

Step 4: Here is the sample updated file.

<?xml version ="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="PrivateAssemblies;PublicAssemblies;PrivateAssemblies\DataCollectors;PrivateAssemblies\DataCollectors\x86"/>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.UnitTestFramework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
<system.diagnostics>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="EqtListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Temp\MSTestTrace.log" />
      </listeners>
    </trace>
    <switches>
      <add name="EqtTraceLevel" value="Verbose" />
    </switches>
  </system.diagnostics>
  <appSettings>
    <add key="GetCollectorDataTimeout" value="300"/>
    <add key="TestProjectRetargetTo35Allowed" value="true" />
  </appSettings>
</configuration>

Step 5: Restart the “Visual Studio Team Foundation Build Service Host” service on build machine. The next build would log the detail.

Friday, March 2, 2012

Disable All Build Definitions, Build Controllers and Build Agents using SQL

We had a situation where we need to disable all the build definitions, build controllers and build agents without bringing TFS up and running. This was on QA instance, we backed up and restored the database on QA from Prod, so when we brought QA TFS up, TFS QA started running all the scheduled builds on Prod build controllers, which caused the problem.

Here are the SQL commands I ran on TFS QA database, which disabled all the 600+ build definitions and 100+ controllers

Use TFS_<Collection Name>

--Disable Build Agents

Update dbo.tbl_BuildAgent Set [Enabled]= 0 Where [Enabled]=1

--Disable Controllers

Update dbo.tbl_BuildController Set [Enabled]= 0 Where [Enabled] =1

--Disable Build definitions

Update dbo.tbl_BuildDefinition Set [Enabled]= 0 Where [Enabled] =1

Friday, February 10, 2012

Add External exe to Setup and Deployment project (VS 2008)

Here are the steps. 

Step 1: Select the Application Folder and add File

image

Step 2: Choose the file

image

Step 3:  The external exe is being added successfully. The only caveat to this is, if the exe is not in TFS (Source control), when other team members trying to open this project. It will fail to load. So the external exe needs to be provisioned on some shared location (if this is not in TFS)

image

Thursday, February 9, 2012

How to use new/custom build template in the Build Definition

Step 1: Add/check-in the custom/new build template into TFS under “BuildProcessTemplates” folder on the Team Project.

Step 2: Create New build definition or Edit the existing build definition

image

Step 3: Click on the Process node and expend the “Build Process Template”

image

Step 4: Click the new button

image

Step 5: Select the Custom/New Build template

image

Now the new build template would be available for this Team Project

Thursday, January 26, 2012

Create TFS reports using Excel Reporting

TFS 2010 has lot of Excel reports and a report template to use TFS Analysis services

clip_image002

Customizing existing Excel report

Open up the report from TFS

Here is “Build Status” Excel report

clip_image004

On the Pivot Table Field list, you can drag and drop fields to Report Filter/Series/Categories/Values section to change the reports look and feel

clip_image006

Guidance tab

There is a guidance tab in all the excel reports, it provides the detail about the report

clip_image008

Creating Report from Report Template

Open the Report Template from TFS

clip_image010

Highlight the PivotTable, the PivotTable Field List window appears

On the “Show fields related to” dropdown select the perspective you would like to report on

clip_image012

On the Pivot Table Field list, you can drag and drop fields to Report Filter/Series/Categories/Values section to change the reports look and feel

clip_image014

Adding PivotChart

Click on PivotChart menu, it shows the Chart list, pick the chart you would like to include

clip_image016

clip_image018

Creating Database connections

clip_image020

Enter the reporting server name

clip_image022

You can create connection to the whole Team System cube or individual Perspective

clip_image024

Click next and finish wizard to create the database connection

Changing data Source

Click on the PivotTable, the “PivotTable Tools” menu appears on the menu bar and select “Options”

On the “Change Data Source” menu select Change Data Source menu

clip_image026

Choose connection from the existing connections.

clip_image028

Creating TFS Reports using Report Builder

 Step 1: Go to Reports Site and click on “Report Builder”

clip_image002

clip_image004

Report Builder screen

clip_image006

Step 2: Double click on the Perspective you want to report on. It opens up Design report view

clip_image008

Step 3: Fill in the report title, drag and drop the fields

clip_image010

Step 4: Adding totals

clip_image012

Step 5: Adding filters. Click on Filter menu. On the Filter Data screen, drag and drop the filters

clip_image014

Step 6:  Executing the reports

clip_image016

clip_image018

Tuesday, January 24, 2012

Team Query: Filter Fields by Team Project/Process Template on TFS Web Access 2010

By default TFS Web Access 2010 shows all the fields from TFS while creating the Team query. If you have team projects created using various Process templates, you might end up creating a query using a field from incorrect process template/team project.

You can restrict the Filter fields on TFS Web Access 2010 by selecting a Team Project (Which is nearly same as process template)

image