NewBugData Object

Applies to TestComplete 14.40, last modified on April 22, 2021

The NewBugData object 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 NewBugData object holds data for creating a bug in the Jira database. Then, the bug will be created by using the PostIssue method.

Members

Example

The code below demonstrates how you can use NewBugData object 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

PostIssue Method

Highlight search results