September 18, 2008
Create StarTeam Change Request on Test Run Failure
Email sign up
This sample uses a TestTrack trigger to create a change request in StarTeam upon a failed test run. You'll need:
Works with TestTrack 2008
Works with Borland StarTeam 2008
- 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.
- An automated TestTrack trigger that creates a change request in StarTeam when a test run fails.
DownloadThe 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 TriggerYou need to create a trigger in your TestTrack project to call the CreateIssue.bat you just downloaded.
- Login to your TestTrack project.
- Choose Tools > Administration > Automation Rules. Click the Triggers tab.
- Change the Type drop-down to Test Runs.
- Click Add to create a new trigger. Enter a trigger name, such as Create SC Issue.
- 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.
- Click the Actions tab, click Add and select Run executable from the list.
- 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 ItThe 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 NotesIf 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.