September 18, 2008

Create StarTeam Change Request on Test Run Failure

Helix ALM

Works with TestTrack 2008

Works with Borland StarTeam 2008

This sample uses a TestTrack trigger to create a change request in StarTeam upon a failed test run. You'll need:
  • An existing StarTeam installation and the necessary permissions to create change requests and access their COM API.
  • Permissions within your TestTrack project to create executable triggers.
You'll get:
  • An automated TestTrack trigger that creates a change request in StarTeam when a test run fails.

Download

The download contains the source files and binaries needed for this sample. Download the Create Issue on Failed Test Run zip file.
  • CreateIssue.exe - Executable built with C# .Net and Visual Studio 2005. This script handles pulling the test run information from TestTrack TCM, and creating the new change request in StarTeam.
  • CreateIssue.bat - Batch file that acts an intermediary between the TestTrack trigger and the CreateIssue.exe.
  • Source Code - Visual Studio 2005 solution and all required source code to build the CreateIssue.exe. You only need this if you want to make changes to the script. If you follow the steps in this article, the included .exe will work just fine.

Create TestTrack Trigger

You need to create a trigger in your TestTrack project to call the CreateIssue.bat you just downloaded.
  1. Login to your TestTrack project.
  2. Choose Tools > Administration > Automation Rules. Click the Triggers tab.
  3. Change the Type drop-down to Test Runs.
  4. Click Add to create a new trigger. Enter a trigger name, such as Create SC Issue.
  5. Click the Trigger When tab, select After Save then Test Run enters the Failed state. This creates a trigger that executes after a test run .
    Note: this is dependent on your workflow, so if you don't have a Failed state, pick some other state.
  6. Click the Actions tab, click Add and select Run executable from the list.
  7. Enter the path to the CreateIssue.bat you downloaded, being sure to wrap the path in quotes if it contains spaces.
You're all setup in TestTrack. Now you need to edit the CreateIssue.bat to call the CreateIssue.exe with the necessary parameters. When calling CreateIssue.exe, you need to pass your StarTeam server's address and port along with project name, username and password in plain text. For example, C:CreateIssue.exe "myserver" "49201" "StarDraw" "Administrator" ""

Try It

The only thing left to do is to fail a test run in TestTrack TCM. If you're using the default workflow, you can simply Quick Fail a test run, and you should get a new issue created in StarTeam.

Tech Details and Notes

If the failed test run is part of a Test Run Set, the app will look for a View with that name and create the change request in that view. If none exists or a Test Run Set is not set, the default View is used. In all cases, the new change request is added to the root folder of the View. The following data is included in the issue:
  • Synopsis is set to the test run's summary.
  • Description is set to the test run's Steps data.
  • External Reference is set to the ttstudio link of the failed test run.
  • Type is set to Defect.
Note: Seapine does not provide support for sample triggers.