You can add Helix ALM issues using statements in scripts to automatically report errors found during playback. Issues are added to the Helix ALM project configured for the workspace the script is in.
Statements you use to add issues depend on the information to add to the issue and actions to perform related to the issue.
| If you want to: | Then: |
|---|---|
| Create an issue with information only in the Summary, Description, Steps to Reproduce, and Other Hardware and Software fields | Use the AddIssue statement |
| Create an issue with information in other fields, add file attachments to the issue, or get information from the issue before adding it to the project | Use advanced issue statements |
Use the AddIssue statement to add an issue with information only in the Summary, Description, Steps to Reproduce, and Other Hardware and Software fields during playback. See AddIssue.
To add information in other issue fields, you must either manually edit the issue after it is added to Helix ALM or use advanced issue statements.
In the following example, an issue is created, the Summary, Description, Steps to Reproduce, and Other Hardware and Software field values are set, and the issue is added to the Helix ALM project to report an error with the number of items available in the comboboxProduct control.
numProducts = Window("BugReporter").ComboBox("comboboxProduct").Property("Number of Items")
If numProducts <> 7 Then
AddIssue("Incorrect number of products found", "Expected: 7 Actual: " + numProducts + " (reported by script '" + ScriptName()+ "')", "See test case", "Windows 7")
End If
Using advanced issue statements
Use the advanced issue statements to create an empty issue, set and work with issue fields values, attach files to the issue, and then add the issue to Helix ALM.
To add an issue using advanced statements:
1. Add the NewIssue statement to create an empty issue object.
2. Use the SetFieldValue statement to set values in the specified issue fields and the AddFileAttachment statement to attach files to the issue.
Note: You can also use the GetFieldValue and RemoveField statements to work with issue fields. GetFieldValue returns values from issue fields for verification or use in other script lines. RemoveField removes values from fields.
3. Add the AddToHelixALM statement to add the resulting issue to Helix ALM.
In the following example, a new issue object is created to report an error with the text displayed in the resultsDlg control. The issue Summary, Description, Product, Severity, and Windows Version fields are set before the issue is added to the Helix ALM project.
resultMessage = Window("resultsDlg").Label("lblMessage").Property("Text")
If (resultMessage <> "OK") Then
' Results dialog indicated an error occurred
' Create a new, empty Helix ALM issue
issue = NewIssue()
' Format the summary string
dim values(2)
values(1) = ScriptName()
values(2) = resultMessage
summaryString = Format("Automation Test ({0}) Failed with message: \"{1}\"", values)
' Set the Summary field
issue.SetFieldValue("Summary", summaryString)
' Set the Description and Product fields
issue.SetFieldValue("Description", "The script played back to completion, but the results dialog indicated that an error occurred.")
issue.SetFieldValue("Product", "WysiCorp")
' Determine and set the issue severity
If (FindSubStr(resultMessage, "Critical", 0) <> -1) Then
' This is a critical issue
issue.SetFieldValue("Severity", "Critical")
Else
' This is a minor issue
issue.SetFieldValue("Severity", "Minor")
End If
' Set the custom Windows Version field
issue.SetFieldValue("Windows Version", GetWindowsVersion())
' Add the issue to Helix ALM
issue.AddToHelixALM()
End If