January 6, 2009

Attach TFS Check-in to TestTrack

Helix ALM

Works with TestTrack 2008 and later and Team Foundation Server 2008

This article outlines how to create a check in policy in Team Foundation Server, which checks the comments passed in a check-in event, ensures that a defect number is included in the comments, and then updates TestTrack. You'll need:
  • The TestTrack SOAP SDK installed.
  • The path to your TestTrack SDK installation. If you're familiar with how web servers work and your IT environment, you can probably guess this. If not, ask the TestTrack administrator or IT staff for help.
  • Team Foundatin Server and the necessary permissions to check in files.
You'll get:
  • A Team Foundation Server Check in Policy that automatically associates check-ins with one defect in TestTrack.
What we'll do:
  • Review the code we're going to use to implement this policy.
  • Go through an example of using the policy.

Team Foundation Check-in Policy

The policy file we will be using is written in C#. Most of the examples provided are in C#, so this made it easier to simply add the section for TestTrack. Once called by Team Foundation Server, the policy file does the following:
  • Uses the Team Foundation Server API to fetch the comments and list of files changed by the changeset.
  • Parses out the comment.
  • Looks for the following token in the comment: <:defect#:>. An example would be: <:12:>
  • If the token is found, parses out the files submitted with the changeset and links them to the SCC tab of the referenced defect.
In the example above, the script will attach all of the files in the changeset to defect 12, along with the changeset number. Other items of interest:
  • If the server where Team Foundation Server is running is also running share point, you may need to install the TestTrack SOAP CGI executable on a different web server altogether. SharePoint seems to take over IIS, and if you must run the TestTrack SOAP CGI on the same IIS instance, you may have to assign a different IP address to the web site running the TestTrack SOAP CGI.
  • The code could be enhanced to be more stringent when parsing the comments. At this time, it only looks for the token elements ("<:" and ":>"), but it does not check that the open element is before the close element.
  • The code could be enhanced to first make sure that the defect exists in TestTrack. If not found, a meaningful error message is displayed to the user.

Set up the custom check-in policy

I am going to have to defer to the experts at Microsoft for this. Everything I needed to set up this I got it from here. While this article talks about version 2005, it also applies to 2008.

Configuration File

The script will read in information used to connect to the TestTrack server from a configuration file called TTConfig.xml. This file should be located in the same directory as Visual Studio (devenv.exe). Following is a sample config file that is saving all connection information
<?xml version="1.0"?>
<ROOT>
  <ServerAddress>http://localhost/scripts/ttsoapcgi.exe</ServerAddress>
  <Project>TestTrack ALM</Project>
  <TTUserName>Administrator</TTUserName>
  <TTPassword>password</TTPassword>
</ROOT>
Following is a brief description of each item in the config file: Server Address: The URL location of the TestTrack SOAP CGI (ttsoapcgi.exe). Project: The TestTrack project to log in. User Name: User name to use to log in to TestTrack. Password: Password of the above user Note: The user name must have the permission to log in via SOAP enabled in his/her security group.

Testing the policy

Now we can actually use the policy!
  1. Check out a file from a Team Foundation Source Control folder.
  2. Edit the file and save change.
  3. Check in the change.
  4. Enter <:1:> This is my first attempt at using the check-in policy that will integrate TFS with TestTrack!! as the comment for the check in.
Now you should have a file linked to defect #1 in your TestTrack project, on the SCC tab. Unfortunately, there isn't an integration between TestTrack and TFS, so this can only be used as a reference in TestTrack. You will not be able to perform any source control actions.

Questions, Comments, Bugs?

If you have any questions, comments or would like to report a bug with this plugin, feel free to shoot me an email. Keep in mind that this plug in is provide by me and not supported by Seapine.

TTCIPolicy Downloads

These downloads are provided on an as-is basis. These are not supported by Seapine Software

2.0

Download:TTCIPolicy_2_0.zipDate: April 5th, 2010 Comments: Only includes .dll and sample config file. Information is not hard coded and therefore changes are not needed. Written and tested against version 2010 of TestTrack and TFS 2008.

1.0

Download:TTCIPolicy.zipDate: January 6th, 2009 Comments:First version, includes source code. Does not use configuration file and TestTrack connection is hard coded. Changes are needed in order to be used. Written and tested against version 2008 of TestTrack and TFS.