Thursday, October 14, 2010

TFS2010 Automated team project creation

This is a update on a the code from a previous post TFS Admin, Part II - POC Automated Order process. It has been upgraded to handle tfs2010 and different team project collections .

The feature set includes

• Order form for team project.
• Approval of team project orders
• Automatic team project creation
• Assigning of admin permissions to project admin.
• Reassigning work items to project admin
• Assigning contributors (New)
• Applying standard enterprise access rights
• Applying standard policies
• Sending notification email to project admin

Future plans
I'm in progress of implementing post creation synchronization of contributors. At the moment you can add contributors by editing the contributors field in the SharePoint list. The tool then synchronizes (add) the user as contributor to TFS, RS & WSS. So far the tool doesn't remove contributors or synchronize the list of contributors in SharePoint with the team project. The goal is to make it possible to handle the most common tfs user administrative tasks directly in the SharePoint portal, without installing any client side tools.

Code, Binaries and SharePoint list template
You can find the source, binaries and a SharePoint list template at my skidrive The process of implementing is described in the TFS Admin, Part II - POC Automated Order process post. The process is most about about creating a custom list in sharepoint and edit the tools config file.

Monday, September 6, 2010

Main TFS server upgrade

During the weekend my colleges and I upgraded our main tfs server with 150+ users to tfs2010. We started to plan this upgrade in April, and overall it has been a smooth and easy upgrade. But of course it always turns up things you didn't expect then you started planning. This post contains our unexpected findings, and how we solved them.

The plan
First a short description of our plan. In order to minimize the risk and minimize disruptions, we choose a migration upgrade. Choosing a migration upgrades allows us to have an good and easy rollback plan but even more important, we can do several real life rehearsals.
Our plan covered three rehearsal upgrades. The first rehearsal is just error pruning, go for a upgrade and see what problems you detected. We also start documenting , creating scripts and time every step.
The second rehearsal main objective is to verify your fixes. It is also a good way to test and make final adjustments to your own documented install process. A third run is a good idea, just to prove that everything works without any surprises. After a run without unexpected surprises you are ready to do the upgrade

SharePoint 2010
Our original plan was to move to SharePoint 2010 during the migration. During the first test run it came clear that the heave use of Conchangos Scrum for Team System template in combination with the lack of support and problem to get even the latest SfTS template to work with SharePoint 2010 was a showstopper.Back to wss3 until SfTS supports SharePoint2010

New reports missing permissions
During the migration a reports are created at /TfsReports/DefaultCollection/TeamProject . It turned out that the permissions is not migrated, leaving it inaccessible for team members. Needing to fix this 100+ folders we made a short program to copy the permissions from the old report folders to the new 2010 report folders. You can find the program and the source at my skydrive

Conchangos Scrum for Team System wss templates.
It is a well know fact that the SfTS 2.2 template and TFS2010 upgrades represents a big problem, good news is that EMC has released plans to make a WorkItem Migrator, at least a step in the right direction. Never the less, we didn't anticipate to have so much trouble getting SharePoint template for SfTS project portals in place. Without it all project portals and document libraries for project based on the SfTS template is inaccessible, SharePoint simply returning http error 404.
Our solution was to do a simply filecopy of the folder C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\SCRUM, from the older server to the same location on the new server.

The new buildreport not working
The jury is still out on this one. The new build report gives us the following error.
  • File system error: The record ID is incorrect. Physical file: \\?\D:\OLAPDATA\Data\Tfs_Analysis.0.db\Dim Build Platform.0.dim\5.BuildPlatformName.(All).ostore. Logical file: .
We have spent several hours rebuilding the cube and warehouse without any success. I will post an update when we have solved this issue.

Tuesday, August 10, 2010

Walkthrough: How to import Word test cases to MTM

Lately I been getting lots of hits on my posts about the extended Test case migrator tool, and even some questions on how to use it. This post is a quick walkthrough to show how to use the tool to import test cases in word documents to Microsoft Test Manager.

Before we start
The first thing you need to do is to get the extended test case migrator tool running. Please refer to my previous postsTool for import word test case documents to Microsoft Test Manager and You can download either the compiled exe or the complete soure code and compile it yourself.

Getting started
The first you need to do is verify that your test case documents can be parsed by the extended test case migrator (TCM). The extension I made for TCM is intended to import test cases written for humans. It relies on that your document is formatted using font styles or colors. The simplest way to verify if your document can be parsed is simply to try to parse it using the tool.

#1 Select your source
After starting and clicking Next in the welcome screen the first real step is to select your data source. In order to import word test cases select the Word TestCase document (table format) and enter or select the path to a folder containing your word test cases.

#2 Select your target team project
The next step is to select your target team project. You also need to select the Work Item Type representing a Test Case.

#3 Create a new settings file
The third step is to simply create a new settings file. You can also load a previous saved settings file.

#4 Fields listing

The next step is to modify the list of detected fields. The tools scans a document for labels and captions and presents a list of them. If you miss any field you can add and you can them and the tool will check if it can find it. If your list is empty or doesnt contain any of the fields you expected your document layout can't be processed by the current version of the tool.

You can also delete unwanted fields from the list to make it simpler to handle in the coming steps. When you click next all documents are scanned to verify that the fields can be found in every document. This can take a while if you have many documents, for example 100 documents takes 10-20 minutes (or more) to scan depending on your computer.

#5 Map your fields against TFS fields
Now it's time to map your "word" fields against the fields in the tfs test case work item. The Test Step Title and Test Step Expected Result is treated special and the tool will iterate through all values and create test steps.

#6 Map values against TFS values
For fields who has defined value lists in TFS you will be prompted to map your word value against the valid TFS values. In this example I mapped the TFS Area fields against the RequirementReference word field in the previous step. This will allows me to map the text values in word to an Area path in TFS.

#7 Save settings

Before you start importing you can save your settings to a file and change the default location of the log file.

#8 Confirm
Simply click Save and Migrate to start the import. As most of the work is done in earlier steps the import process is rather quick.

#9 Verify outcome
After the import is completed you will hopefully se a screen similar to this. You may also receive warnings and errors for part of the import. If you do, click the View output log file link and try to figure out what documents has problems and what to do to it.

Tuesday, June 8, 2010

Updates to my extensions of the TestCase Migrator Tool

As described in my earlier post I made some extensions to the Test Case Migration Tool, so it can handle importing old test cases in word documents to Microsoft Test Manager. Recently I have tested to import 100+ test cases with a slightly different template. Of course its always something that can be done better so I've updated my extensions to be more tolerant to differences in templates.

You can find the latest bits
You can also find the source at

Saturday, May 29, 2010

Last changed Team projects - Custom Report for tfs 2008

As a TFS admin I sometime wonder how many team projects is in use and maybe when it was last changed. Sometimes I've been forced to find out and I have created some SQL queries to run against the warehouse to figure it out.

Packaged into an custom SSRS Report
Now I have packaged those queries into a custom SSRS report for tfs2008. You download the report at my skydrive Once downloaded you simply needs to upload it to your own TFS Server and point the data source to the tfs standard TFSReportDs shared data source.

TFS2010 updated version

Monday, May 17, 2010

TFS with WSS 3 to SharePoint Foundation 2010 upgrade

During the weekend we successfully upgraded a production server from TFS2010Beta2/WSS3 to TFS 2010 RTM/SharePoint Foundation2010 RTM. The new challenge in this, apart from the usual upgrade of a production server, was to include upgrading WSS3 to SharePoint Foundation 2010.

Migration scenario
In this case we went for the Server Migration/upgrade scenario, which is very good if you need to verify and test our upgrade routines. This was very important as we to include the move from WSS to SharePoint Foundation 2010 in the upgrade and the WSS upgrade procedure hasn't made it into the official installation documentation yet, so we had to find the right way before we went for the big move.

Don't forget the InstanceId
If you migrate your server to a new hardware for testing purposes, or simply keeps the original server on the network, you have to change the instanceid of your server. Buck Hodges has a post on this, including information on how to change instanceid in TFS 2010.

Installation of SharePoint Foundation 2010
This was really simple, once I got the install of SharePoint Foundation 2010 right. Sadly to say it took me several tries getting a new unwanted separate SQL instance for SharePoint. If you want to use your existing SQL instance you have to select Server Farm installation and then Complete Server Farm. IF you select that path, you can point out your existing SQL Server instance during configuration.

Upgrade from WSS to SharePoint Foundation 2010
Searching for information how to upgrade tfs & wss to SPF 2010 I found this posts
During verification of content db it prompted for two non blocking missing components, as expected, as I had not configured TFS and it SharePoint extensions yet.
Attaching the content db using stsadm -o addcontentdb -url -databasename resulted in an attached and upgraded content database up and running according to the Managed content databases pages in SharePoint Central Administration. Browsing to team project portals did howevere not work at this stage.

After configuring TFS and upgrading the team project collection witch installs the TFS add-ons to SharePoint, browsing to the project portals worked fine as far as we could se.

The upgrade process in short steps
Install Server roles according to TFS installation
Install SQL Server according to TFS installation
Install SQL Server SP1 Cumulative update package 2, KB 970315 (
Restore Reporting Services
  • Stop Reporting services
  • Restore backup,
  • Start
  • Restore encryption keys
  • Remove Orginal server from scale out deployment
  • Verify
Install SharePoint Foundation 2010 PreReq
Install SharePoint Foundation
  • Select Server Farm,
  • Select Complete
  • Configure
  • Create New Farm
  • Use existing SQL server

Install Team Foundation Server
Import wss3 content database
  • Verify using SharePoint 2010 Management Shell and run Test-SPContentDatabase –Name -WebApplication
  • 2 Missing components
  • Attach database stsadm -o addcontentdb -url -databasename

Configure TFS
Upgrade team project collection
Update Instance Id
  • iisreset /stop
  • tfsconfig changeserverid /sqlinstance: /databasename:Tfs_Configuration
  • tfsconfig registerdb /sqlinstance: /databaseName:Tfs_Configuration
  • iisreset /start
  • net start tfsjobagent

Wednesday, April 21, 2010

Sogeti TMAP process template certified and ready

Today we finalized the RTM version of our TMAP process template and it will soon be available for free download from the official TMAP.Net site there you also can find more information about the TMAP process and the latest news from the testing field. You can also go directly to the download page located at

Certified process template
Sogeti's TMAP template has as the first template passed the new Visual Studio Certified Process Templates Program announced by Microsoft and can therefore use the new Certified process template logo. If you want to know more about the certification program Stephanie Saad Cuthbertson has a post on the details.
The TMAP template will continue to develop and improve on codeplex. You will still find the latest bits and contribute on the future directions of the TMAP process template by filing feedback and suggestions at

Upgrading TFS 2010 RTM from pre-release versions

Today I upgraded one of our internal pre-release server and moved in to a new machine. What before in the old days with TFS2008 could be a real painful experience taking several hours or even days to perform could now mostly be handled in an hour.

This post is simply a brief description of the main steps and what to do and expect. If you want a more detailed information and as preparation always is the key to success I recommend you to read the following
Backup and In place upgrade
The first step is to backup the current environment, be it databases or taking a snapshot of your existing environment. Once that's done Its time to uninstall the previous installed pre-release versions. You can leave the .Net framework as it will be upgraded, but TFS2010 Beta2/RC must be uninstalled. After removing the Pre release versions simply install TFS2010 RTM, It's a very easy and quite fast but did take me a reboot to finish it.
Once installed its time to configure your server. If your moving from prerelease versions it's important that you select Upgrade in the first page of the configuration wizard. Follow the steps of the wizard and then you finish the upgrade you will have an upgraded Team Project Collection.

Move to new machine = Detach, Move, Attach
If you want to move to a new clean machine (without any previous installed beta software) you simply Detach your newly upgraded team project collection using Team Foundation Administrative Console. Once detached backup the database TFS_MyProjectcollectionName to file using SQL Manager.
Now it's time to move to a new fresh start. Simply Install and configure TFS2010 RTM on a clean machine. After its done, restore the previous backed up database to the new SQL Server using SQL Manager. Once installed its time to attach, simply point out the database and attach it to your server and you now have your upgraded team project collection up and running on your new server.

Friday, April 9, 2010

Tool for import word test case documents to Microsoft Test Manager

Updates to my extensions of the TestCase Migrator Tool

Recently I had a case there I needed to import old test cases written in word into Microsoft Test Manager. I looked around for a tool capable of importing an ordinary test case written in word, but I didn't find any tool or solution.

Word - the world's most used test tool ?
In my experience most projects who have had formalized test cases has done them in word documents containing test case information (title of the test case, description, pre-conditions, use case identification) and test steps. The test steps has the format of a table with columns for actions and expected results.

Test Case Migration Tool on codeplex
The best match I found was the Test Case Migrator Tool on codeplex ( With this tool I could import Excel test cases and MTH files (Microsoft's word template for test cases from earlier versions of Microsoft Test Edition). This looked like a promising tool but when I tried it on our existing test cases written by a standard test case template the tool didn't manage to import the test cases. It seemed the tool was to hard connected to the structure of the MTH template.

Extending the Test case migration Tool
As the project was on codeplex with the source code available I did take a look to see if I could adopt the tool to our template. As the tool had a nice separation of the logic for parsing and importing data sources , I simply created a new data source and wrote my own parsing logic for our template. At first i simply replaced the MTH data source with my, but ones I got the parsing logic to work I started to integrate it as a new data source in the UI. This turned out to be a bigger task then writing the parsing logic. It took some time but at least the result looks good.

The extended Test Case Migration Tool is available
I have uploaded both the compiled version and the source with my modifications as I guess many other will find themselves in the same situation as I was - looking for a tool to batch import word test cases. Hopefully this could be a solution for some of you .

Thursday, April 8, 2010

Contacting all users running non Tfs2010 compatible clients

Looking at migrations of several tfs servers with 100+ users, I got the urgent need to track and inform users not already upgraded vs2008 & vs2005 with forward compatibility pack. Tracking is easy, I use the Tfs Scorecard and its activity logging features to figure out who is running vs200 RTM and SP1 clients. The problem is that I don't get a good list to paste into a mail, due to reports format and user formats.

Easier to send mail
After looking at the report a number of times and thinking " It would be good to have an send mail button" I finally did something about it. In the Tfs Scorecard clients report I added a list of user accounts and a Send Email link creating a new email with all email addresses, visible if you expand the first level.
This latest feature is now available in source control at , direct link

Friday, March 26, 2010

Swedish site about VS2010 TMAP process template

Now you can read more about Sogeti's TMAP process template for Visual Studio 2010 (in Swedish). At you can find a brief description of Microsoft test tools and Sogeti's TMAP process template.

TMAP Flyers
You can also download flyers (in Swedish) for the VS2010 TMAP and process template. There is also flyers focused only on TMAP as a method and Sogeti's other testing services.

Events about TMAP and Microsoft Test tools
You can also find information about upcoming events around Microsoft test tools and TMAP. The first event will be at Microsoft Sweden on the 23 of April. This event will be followed by several events around the country.

Tuesday, March 9, 2010

TMAP for VS2010 RC released

Clemens just released a new version of Sogetis TMAP process template for VS2010. Ive just started to install it on our swedish 2010 pre-release server so our swedish testers can evaluate ,learn and contribute to it.

Sunday, February 28, 2010

Upgrading TFS event subscriptions to 2010 SDK

Some days ago I started to upgrade one of my TFS customization to the 2010 SDK. The application I moved uses WCF to host its services and automatically subscribes and consumes TFS events. It didn’t turn to be the easy, straight on upgrade I thought it should be. This is my findings during the upgrade.

Relocated TFS SDK assemblies
The first (and about the only) thing I expected was to be replace TfsServer with TfsTeamProjectCollection, and in some cases TfsConfigurationServer. Moving my solution over to a new and clean machine with only VS2010 on it, I discovered that the Tfs SDK Assemblies has moved away from its old locations. After some searching I found the new location C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0

Where did IEventService go ?
After finding the new assemblies, replaced TfsServer with TfsTeamProjectCollection I still had some compiler errors, the IEventService interface was unknown? I tried to search for any information about changes in 2010 but came up short. After some searching I found it again. It had simply moved around in the namespaces and is now located at Microsoft.TeamFoundation.Framework.Client namespace.

Windows 7 security
With all compiler errors fixed, it was time for a first test. I started the application and got direct failure. It turns out that you have to grant rights to url namespaces with
netsh http add urlact url=http://+:8001/ServiceUrl user=mydomain/mysuser
After granting rights to my user the the services starts and the application subscribes to events.

TFS2010 switched to Soap1.2
After some testing I don’t receive any incoming notifications. Following Grant holidays post TFS2010: Diagnosing Email and SOAP subscription failures ( shows me the following error
HTTP code 415: Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'
This indicates that tfs has switch to Soap 1.2. To solve this I simply switch the bindings of my services from BasicHttpBinding till wsHttpBinding

Finaly working
The last thing it took to get the events working was to change the security mode to SecurityMode.None. So if you want to set up an WCF endpoint this code will do it, without any extra configuration files.

Uri baseaddress = new Uri("http://" + System.Environment.MachineName + ":8001");
srvHost = new ServiceHost(typeof(NotificationServiceImpl), baseaddress);

// Check to see if the service host already has a ServiceMetadataBehavior
ServiceMetadataBehavior smb = srvHost.Description.Behaviors.Find();
// If not, add one
if (smb == null)
smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Default;
// Add MEX endpoint

srvHost.AddServiceEndpoint(typeof(INotificationService), new WSHttpBinding(SecurityMode.None ), "StructureChangeNotify");

Complete code
Below you can find the complete code, you can also download a zip file with the solution from my skydrive

// INotifyServices.cs
namespace EventSubscriber
[ServiceContract(Namespace = "")]
public interface INotificationService

[OperationContract(Action = "", ReplyAction="*")]
[XmlSerializerFormat(Style = OperationFormatStyle.Document)] /* Took me hours to figure this out! */
void Notify(string eventXml, string tfsIdentityXml);


namespace EventSubscriber
public class NotificationServiceImpl : INotificationService
void INotificationService.Notify(string eventXml, string tfsIdentityXml)

// Form.cs
using System;
using System.Windows.Forms;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Client;

using System.ServiceModel;
using System.ServiceModel.Description;

namespace EventSubscriber

public partial class Form1 : Form
protected ServiceHost srvHost;
protected int subscriptionId;

public Form1()

private void cmdStartWCF_Click(object sender, EventArgs e)

Uri baseaddress = new Uri("http://" + System.Environment.MachineName + ":8001");
srvHost = new ServiceHost(typeof(NotificationServiceImpl), baseaddress);

// Check to see if the service host already has a ServiceMetadataBehavior
ServiceMetadataBehavior smb = srvHost.Description.Behaviors.Find();
// If not, add one
if (smb == null)
smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Default;
// Add MEX endpoint

srvHost.AddServiceEndpoint(typeof(INotificationService), new WSHttpBinding(SecurityMode.None), "WorkItemChangedNotify");


lblRunning.Text = "Running";


private void cmdStopWCF_Click(object sender, EventArgs e)
lblRunning.Text = "Stoped";


private void cmdSubscribe_Click(object sender, EventArgs e)

TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(txtServerUrl.Text));

IEventService eventService = tpc.GetService(typeof(IEventService)) as IEventService;
DeliveryPreference delPref = new DeliveryPreference();
delPref.Address = "http://" + System.Environment.MachineName + ":8001/WorkItemChangedNotify";
delPref.Schedule = DeliverySchedule.Immediate;
delPref.Type = DeliveryType.Soap;

subscriptionId = eventService.SubscribeEvent(System.Environment.UserDomainName + "\\" + System.Environment.UserName, "WorkItemChangedEvent", "", delPref);
lblSubId.Text = subscriptionId.ToString();


private void cmdUnsubscribe_Click(object sender, EventArgs e)

TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(txtServerUrl.Text));

IEventService eventService = tpc.GetService(typeof(IEventService)) as IEventService;
lblSubId.Text = "na";


Wednesday, January 20, 2010

Performance optimizing with the vs2010 profiler I

Optimizing existing code for performance is one of my favorit tasks. It is a work what gives immediate measurable feedback, always learns you something new, and is in many cases easier then you think, especially if you use the new profiler in vs2010.

The first thing you need to do is find some way to test that you still deliver the same functionality. Now days this tends to be less of a problem, as many projects tends to have some kind of unit tests (although in many cases it’s more automated Integration tests) . If not it time to write some 
Other ways to accomplish this is to agree/ write some testcases

Establish a base line
Once you have a way to test that you don’t (unknowingly) change the functionality its time to find and reproduce the performance issues. It is not reproducible in a new environment, it's in most cases better to try to find the bottlenecks in the environment before you go for optimizing the code.
After reproducing the performance issues, the next step is to establish a base line. By setting a baseline before you start changing the code you have something to compare your results against. Establishing a baseline is more a procedure and some extra thoughts on how to test and measure your progress. In practical it’s the first performance report you collect from your system saved away

Creating a performance session
Now its time to get started, simply create a new performance session, As before you can choose between sampling and instrumentation.Sampling providing a quick and good enough approach and instrumenting as an more exact and complex approach. I tend to end up doing the instrumenting, although I must admit sampling really is good enough for me, I guess I like the feeling of exactly knowing what’s going on. You can read at msdn: Walkthrough: Profiling Applications

All in one profiling
A new feature in the Vs2010 profiler is that it now collects data about calls to other tires like the database. Before I was most of the time forced to use both the Profiler and SQL server profiler to collect information about database interactions and where execution times. With VS2010 I now can collect basic database interaction information directly in the VS2010 profiler, showing you the queries executed and their execution time. This information is valuable enough to point me in the right direction witch query to look deeper into, although I still can see cases there I will use the SQL Server Profiler.

Better performance reports
One other great improvement from usability perspective is the new graphical presentation of your function, both showing a graphical representation of the time spent in the function, and the code annotated with execution times! The graphical representation of the function calls is also clickable. This makes it really simple and almost joyful to navigate around in your callstack looking at the code and the execution times, giving you a quick idea about what needs and can be improved.
Colin Thomsen has writen 2 post about the new performance reports VS2010: New Profiler Summary Page and VS2010: Investigating a sample profiling report (Function Details)