Create Jira Issue on Test Run Failure
Works with TestTrack 2008 and later
Works with Jira Enterprise 3.12
- An existing Jira installation and the necessary permissions to create issues and access their Soap RPC API.
- Permissions within your TestTrack project to create executable triggers.
- An automated TestTrack trigger that creates an issue in Jira when a test run fails.
The download contains the source files and binaries needed for this sample. Download the Create Defect on Failed Test Run zip file.
- CreateDefect.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 isue in Jira.
- CreateDefect.bat - Batch file that acts an intermediary between the TestTrack trigger and the CreateDefect.exe.
- Source Code - Visual Studio 2005 solution and all required source code to build the CreateDefect.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 CreateDefect.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 Jira 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 CreateDefect.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 CreateDefect.bat to call the CreateDefect.exe with the necessary parameters. When calling CreateDefect.exe, you need to pass your Jira Soap RPC Url, project, username and password in plain text. For example, C:CreateDefect.exe http://localhost:8080/rpc/soap/jirasoapservice-v2 MyProject myuser mypassword
Configure Jira Custom Fields
This step is optional. If you want to use the sample as it is then you'll need to create some custom fields in your Jira project to store the TestTrack test run information. Alternatively, you can modify the code to do whatever you want, then rebuild the exe and go that route. Consult the Jira help or your system administrator if you need help creating custom fields. The following custom fields are used by this sample, and should be named exactly as outlined below.
- Test Run # - Text (<255) field, that will hold the test run number that generated the issue.
- Test Run Url - Url field, which will hold a clickable link to the test run that generated the issue.
Tech Details and Notes
This sample was written and tested using Jira Enterprise 3.12 and TestTrack Studio 2008 The following data is included in the Jira issue:
- Type is set to Bug.
- Summary is set to the test run's summary.
- Description is set to the test run's Steps data, with some minor formatting.
- Issue is assigned to the project lead.
- Test Run # custom field is populated with <Test Case #> - <Test Run #>.
- Test Run Url is populated with the ttstudio hyperlink to the test run.
If you're not familiar with SOAP or the TestTrack SDK, or simply don't have the time to write your own scripts email Seapine Services and they can help. Note: Seapine does not provide support for sample triggers.