Jira.CreateNewBugData Method

Applies to TestComplete 15.68, last modified on October 16, 2024

The Jira.CreateNewBugData method is only available if the external JiraSupport script extension is installed and enabled in TestComplete. To learn how you can do it, see Sending Issues to Jira From Script Tests.

Description

The Jira.CreateNewBugData method creates an object that you use to specify data for a new bug in your Jira project. Then, you use the object to create the bug in your Jira project by using the Jira.PostIssue method.

Declaration

Jira.CreateNewBugData(ProjectKey, Assignee, Priority, Summary, Description)

ProjectKey [in]    Required    String    
Assignee [in]    Required    String    
Priority [in]    Required    String    
Summary [in]    Required    String    
Description [in]    Required    String    
Result The NewBugData object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

ProjectKey

The Jira project identifier.

Assignee

The name of the user the bug will be assigned to.

Priority

The importance of fixing the bug.

Summary

The short bug description.

Description

The detailed bug description.

Result Value

A NewBugData object containing data that will be used by the PostIssue method to create a new bug issue in Jira.

Remarks

An an alternative, you can post issues to Jira on the Test Log page. For complete information, see Add Defect to JIRA Database Dialog.

Example

The code below demonstrates how you can use the CreateNewBugData method in your script tests:

JavaScript, JScript

function BugToJira()
{
  // Log in to Jira
  Jira.Login("https://mycompany.atlassian/net/", "[email protected]", "c40Mwj3PovmRTFZbmIiwB8C2");
  // Create an object that defines bug properties
  var jiraData = Jira.CreateNewBugData("MyJiraProjectKey", "John Smith", "High", "Sample bug summary", "Sample bug description").
                setField("customfield_10700", "12.40.08");
  // Post the issue to Jira
  var key = Jira.PostIssue(jiraData);
  // Attach the desired file to the created issue
  Jira.PostAttachment(key, "C:\\temp\\MyFile.txt");
}

Python

def BugToJira():
  # Log in to Jira
  Jira.Login("https://mycompany.atlassian/net/", "[email protected]", "c40Mwj3PovmRTFZbmIiwB8C2")
  # Create an object that defines bug properties
  jiraData = Jira.CreateNewBugData("MyJiraProjectKey", "John Smith", "High", "This is a sample bug summary", "Sample bug description").\
                setField("customfield_10700", "12.40.08");
  # Post the issue to Jira 
  key = Jira.PostIssue(jiraData)
  # Attach the desired file to the created issue
  Jira.PostAttachment(key, "C:\\temp\\MyFile.txt")

VBScript

Sub BugToJira
  ' Log in to Jira
  Call Jira.Login("https://mycompany.atlassian/net/", "[email protected]", "c40Mwj3PovmRTFZbmIiwB8C2")
  ' Create an object that defines bug properties
  Set jiraData = Jira.CreateNewBugData("MyJiraProjectKey", "John Smith", "High", "Sample bug summary", "Sample bug description")._
                setField("customfield_10700", "12.40.08")
  ' Post the issue to Jira
  key = Jira.PostIssue(jiraData)
  ' Attach the desired file to the created issue
  Call Jira.PostAttachment(key, "C:\\temp\\MyFile.txt")
End Sub

DelphiScript

procedure BugToJira;
var 
  jiraData, key;
begin
  // Log in to Jira
  Jira.Login('https://mycompany.atlassian/net/', '[email protected]', 'c40Mwj3PovmRTFZbmIiwB8C2');
  // Create an object that defines bug properties
  jiraData := Jira.CreateNewBugData('MyJiraProjectKey', 'John Smith', 'High', 'This is a sample bug summary', 'Sample bug description').
                setField('customfield_10700', '12.40.08');
  // Post the issue to Jira
  key := Jira.PostIssue(jiraData);
  // Attach the desired file to the created issue
  Jira.PostAttachment(key, 'C:\temp\MyFile.txt');
end;

C++Script, C#Script

function BugToJira()
{
  // Log in to Jira
  Jira["Login"]("https://mycompany.atlassian/net/", "[email protected]", "c40Mwj3PovmRTFZbmIiwB8C2");
  // Create an object that defines bug properties
  var jiraData = Jira["CreateNewBugData"]("MyJiraProjectKey", "John Smith", "High", "This is a sample bug summary", "Sample bug description")
                ["setField"]("customfield_10700", "12.40.08");
  // Post the issue to Jira
  var key = Jira["PostIssue"](jiraData);
  // Attach the desired file to the created issue
  Jira["PostAttachment"](key, "C:\\temp\\MyFile.txt");
}

To interact with Jira custom fields, use their identifiers instead of the field names. In the code above, it is customfield_10700.

To call this function from keyword tests, use the Run Code Snippet operation.

See Also

Login Method
CreateNewIssueData Method
CreateUpdateIssueData Method
PostAttachment Method
PostIssue Method
UpdateIssue Method

Highlight search results