Migrating data from IBM Rational Focal Point to TFS

I had an assignment that needed to migrate defects (bugs) from IBM Rational Focal Point to TFS  (Team Foundation Server), the data for the defects was as following:

  • 13000 defects
  • 9000 attachment (4 GB size)

I used the API for both, Focal Point and TFS to develop a migration tool……for more information about these APIs, see the following links:

Here are some considerations for anyone may has similar situation:

  • Reading and getting the defects from Focal Point take time especially with the attachments, also saving a work-item with attachment take time, so running the migration after finishing the tool took up  5 hours.
  • Using the API method of getElemtns crashed by thrown out of memory exception for the client that running the migration tool, so we need to get 100 in each round
  • Everything structured by Alias inside Focal Point and you need to get Alias of Work-space—>Modules—->Elements—->Fields
  • Log all the transaction so if there is any exception thrown during the migration, you could know where you stop and where you will need to continue.
  • Handel the exception very well as you don’t want to restart the process if any exception thrown.
  • As the process takes time, try to get a status on what happen by printing out on the console what you read and what you save

How to get SystemRoot folder during TFS Build

Getting the System Root Directory during TFS Build was not straightforward as I thought, so I decide to share my experience on how to get that.

  • I used InvokeMethod activity, in the Target Type I will put the name of the static class that has the method I need use.
  • In MethodName, I will put GetEnviornmentVariable.
  • Write the value to the build log by calling WriteBuildError and past the value return from GetEnviornmentVariable.

6-25-2014 12-53-38 PM

6-25-2014 12-58-59 PM

For InvokeMethod activity, if I need to call a method from an instance object then I will use Target Object not Target Type.



How to Call a batch file from TFS2013 Build?

I run into a situation which needed to run a batch file from TFS Build, this batch file downloads some files from a file server and I just needed to copy that files later during the same build process to another machine.

I will simulate that by creating a batch file that create a file and copy the created file to another machine.

Here is the batch file that create a new text file.
6-22-2014 10-19-33 PM
If I just double click on that file, it will create  a new file called NewFile.txt.
6-18-2014 11-22-07 AM

  1. Open any Build Process Template and delete all its activities.
  2. Add Sequence Activity with name: Overall Build Process.
  3. Drag and drop GetBuildDetail Activity inside the Sequence Activity.
  4. Drag and drop AgentScope Activity with name: Run on Agent.
  5. Drag and drop GetBuildDirectory Activity inside AgentScope Activity.
  6. Drag and drop InvokeProcess Activity with name: Call a batch file.
  7. Declare variable of type IBuildDetail with name: MyBuildDetail,and assign the return value from GetBuildDetail to it.
  8. Declare variable of type String with name: MyBuildDirectory,and assign the return value from GetBuildDirectory to it. More information on how to assign a value to variable from the return execution of activity

6-18-2014 10-33-40 AM

We need to include the folder that contains the script or the batch file in the Source Settings of our Build Definition; so the build server copy it in the working directory of the build.

But first, let’s remember what is the working directory of the build, it’s a folder like a temp folder the build process uses to get the last change set so it could build it, we configure that from TFS Administration Console for the agent.
6-18-2014 11-16-11 AM
So we will need to include the folder that contains the script or the batch file in the Source Settings of our Build Definition.
6-18-2014 11-13-02 AM

So now if we run this build, we will find that it gets the last change set including the script.
6-18-2014 11-17-43 AM

So now I can give the InvokeProcess Activity the path on the working directory as the following.
6-18-2014 11-02-17 AM

Remember if I run the build, the file will not be created in related path, but it will be in System 32 folder
6-18-2014 11-21-38 AM

Then I will need to copy that file to the needed machine, see the following post for typical steps.

How to Copy Build output to a Lab Environment Machine for TFS2013

How to Copy Build output to a Lab Environment Machine for TFS2013

If you want to run Coded-UI test on Lab Environment machine then you need to copy the binaries files to that machine, you can create script that do that but also you can create some customization for the build process to do that as the following.

In our scenario we have 2 machines, the first one (Visual Studio 2013 ALM RTM) it’s a TFS machine with Test Control and the second one (Agent) it’s a machine with Test Agent.
The first step on the Agent machine, share the folder that will hold the binaries.Sharing

From the Tool Box type get and drag and drop GetBuildDetail Activity, you need to put it between Update Build Number and Run on Agent.

Click on variables and declare a new variable of type IBuildDetail to hold the return value from GetBuildDetail Activity, in my case I called that variable RadwanBuildDetail.
IBuildDetail- GetBuildDetail

From properties of the GetBuildDetail Activity assign the result to to the variable that we just declared.
Assign BuildDetail variable

From the Tool Box drag and drop CopyDirectory, you must put it in Run on Agent, from the properties, select the source which is our variable and in the Destination , type the UN path for our shared folder, of course in real scenario you will not hard coded that Destination and you will make that as argument; so you can enter that by just edit the Build Definition.
CopyDirectory Activity
If you run this build the output of the drop folder will be copied to the Lab Management machine.

More information and tutorial about customizing build process


Upgrade TFS 2008 to TFS 2013 Update-2 step-by-step

In this post I will explain a step-by-step walk through on how to upgrade TFS2008 to TFS2013 Update-2.

Here is the flow of the walk through


Here are the steps:


Backup TFS2008 databases or just get them offline so you can copy them.

1-backup tfs 2008 database

Copy Data Files To Data Folder Or Backup Files To Backup Folder on the Data Tire for TFS2012 2-copy data files to data folder or backup files to backup folder


Open SQL Management Studio From Data Tire for TFS2012 3-open sql management studio from data tire of TFS

Attach Data Files or Restore Backup Files If You Made Backup.5-attach all the following databases

Attach All the Following Databases
6-we can see the attached databases as the following

Open TFS2012 Administration Console.7-open tfs 2012 administration console

Click on Configure Installed Features.
8-click on configure installed features

Choose Upgrade and then click Next.9-choose upgrade tab in tfs administration console and click start wizard10

In the Databases section, make sure you select TfsIntegration and you checked the check box to confirm you have a backup.
11-list available database for tfs

In the Account section use the default for the service account (Network Service).12-use network service as a service account13

If you installation of TFS2008 include Reporting like me, click on Configure Reporting for use with TFS.14-configure reporting to use with team foundation server

In my case I needed to choose the secure one as this what we have.15-provide the reporting services settings for team foundation server

In the Analysis Service, type the name of the machine and click Test.16

In Report Reader Account put the service account for reporting service and click Test.17-tfs reporting services reader account

If you have SharePoint click on Configure SharePoint for use with TFS.18-configure sharepoint use with team foundation server

Name the collection, I choose TFS2008_Collection.19-Enter the name of the collection

Configure the upgrade and review the success.19-2

Review your team projects in the TFS2008_Collection.20-examine the old team projects

Detach the collection.
21-tfs 2008 detach collection22-upgrade to tfs 2013

If there is any warning, review it and complete the detach process.2324

Backup The TFS2008_Collection DB.25-backup tfs2008 collection25-backup tfs2008 collection-2

Copy the backup file to the new TFS2013 Server.26-copy the collection backup to TFS 2013 DT Data tier



Open SQL Management Studio From the Data Tire for the TFS2013.27-open sql management on TFS data tier

Attach the Backup of TFS2008_Collection DB.28-attach tfs 2008 collection to tfs 201328-attach tfs 2008 collection to tfs 2013-2

Open TFS2013 Administration Console.28-2

Click Team Projects Collections and then click on Attach Collection.29-Open Team Foundation Server Administration Console

Click on List Available Databases, you should see the restored TFS2008_Collection DB, check to confirm that you have a backup of that database and click Next.30-List Available Dtabases

Name the collection, I choose TFS2008_Collection.31-Provide a Collection Name and Description

Review and then configure.32-Review the confiuration and Verify33-Attach the collection34-Monitor  the Team Project Collection attach porgress

Review the migrated team projects in the TFS2008_Collection.35-Review migrated collection and projects


For more information about versions and options for TFS upgrade

Fix Build-Deploy-Test workflow error, There are no test cases matching the criteria specified

You may face the following error while you running your Build-Deploy-Test workflow:

Exception Message: There are no test cases matching the criteria specified. Use Microsoft Test Manager to view the test cases. (type Exception)

This could happen for many reasons.

You don’t select the test suites that include your test cases, so make sure you select that, see the following image.

You choose d the wrong configuration, so make sure you select the right configuration that match the one existing in the test plan, see the following images.


If you want to change the configuration for the test plan, follow the following steps:

Open your test plan, select your test suite , select all your test cases that you want to change its configuration and click on configuration
Change the configuration