October 24, 2008

Create Defect for Test Run

Helix ALM
TestTrack Studio includes defect tracking (TestTrack Pro) and test case management (TestTrack TCM). Since both pieces are within the same interface they have a tight integration. The focus of this article is on the ability to create a defect from a test run, which typically happens when a test run fails. The user simply clicks on the Create Defect... button on the test run window, fills out the rest of the defect, and optionally establishes a link between the test case, test run and defect. Figure 1 below illustrates the test run window, with the Create Defect... button outlined in red.

Figure 1 - Test run window

But, what if you would like this to be automated? Everytime a test run fails, generate a defect. This can be done rather easily with a script using the TestTrack's SOAP based SDK and TestTrack's automation rules.

The trigger

A trigger is setup in the automation rules to for test runs, to run the script when a test run enters the failed state.

The script

The script gathers information from the TestTrack environment variables, creates the defect and optionally establishes the link. The result is the same as manually clicking the "Create Defect" button.


You can download an example written in Java from here. The ZIP file contains the Jar file and associated libraries as well as the source code files.