Log.CreateIssueFromCurrentLog Method

Applies to TestComplete 15.63, last modified on April 22, 2024

Description

This method creates a new working item in an issue-tracking system and saves the contents of the current project’s log to this issue. The issue-tracking system that will be affected by this method is the one that is defined by the TestComplete project's default issue-tracking template. Usually it is a CreateWorkItem Template. Note, that all parameters of the default issue-tracking template should be specified before using the CreateIssueFromCurrentLog method.

The default template should contain at least two item fields: Subject and Description. When creating a working item in the issue-tracking system these fields are populated with the values specified in the Template Editor and the log is posted as an attachment.

For more information see Issue-Tracking Templates.

Declaration

Log.CreateIssueFromCurrentLog()

Result Boolean

Applies To

The method is applied to the following object:

Result Value

True if a new issue is created successfully and False otherwise.

Remarks

Currently, TestComplete supports creation of issue-tracking reports from the logs that are generated after execution of a project or project suite. In other words, you cannot create issue-tracking reports using the log of your keyword test, for example. If you need to create such a report, you should add your keyword test to a project and then execute the entire project. In this case, the project's log will contain the log of the desired test.

Example

The code below checks whether the test log contains an error. If it does, the routine creates an issue and then saves it to an issue-tracking system. Otherwise, no issue is created.

JavaScript, JScript

function IssueReportExample()
{
  // ...
  var ErrCount = Log.ErrCount;
  
  // Checks whether the test log contains errors
  if ( ErrCount > 0 )
  {
    // Creates an issue
    Log.CreateIssueFromCurrentLog();
    Log.Message("An issue has been created.");
  }
  else
  {
    Log.Message("The test log contains no errors.");
    Log.Message("No issue has been created.");
  }
}

Python

def IssueReportExample():
  # ...
  ErrCount = Log.ErrCount
  # Checks whether the test log contains errors
  if ErrCount > 0:
    # Creates an issue
    Log.CreateIssueFromCurrentLog()
    Log.Message("An issue has been created.")
  else:
    Log.Message("The test log contains no errors.")
    Log.Message("No issue has been created.")

VBScript

Sub IssueReportExample()
  ' ...
  ErrCount = Log.ErrCount
  
  ' Checks whether the test log contains errors
  If ErrCount > 0 Then
    ' Creates an issue
    Log.CreateIssueFromCurrentLog()
    Log.Message("An issue has been created.")
  Else
    Log.Message("The test log contains no errors.")
    Log.Message("No issue has been created.")
  End If
   
End Sub

DelphiScript

function IssueReportExample;
var 
  ErrCount;
begin
  // ...
  ErrCount := Log.ErrCount;
  
  // Checks whether the test log contains errors
  if ( ErrCount > 0 ) then
  begin
    // Creates an issue
    Log.CreateIssueFromCurrentLog;
    Log.Message('An issue has been created.')
  end
  else
  begin
    Log.Message('The test log contains no errors.');
    Log.Message('No issue has been created.');
  end;
end;

C++Script, C#Script

function IssueReportExample()
{
  // ...
  var ErrCount = Log["ErrCount"];
  
  // Checks whether the test log contains errors
  if ( ErrCount > 0 )
  {
    // Creates an issue
    Log["CreateIssueFromCurrentLog"]();
    Log["Message"]("An issue has been created.")
  }
  else
  {
    Log["Message"]("The test log contains no errors.");
    Log["Message"]("No issue has been created.");
  }
}

See Also

Test Results
Integration With Issue-Tracking Systems

Highlight search results