Adding a Picture to the Test Log

Applies to TestComplete 14.10, last modified on June 5, 2019

The following code captures the entire screen as a bitmap and inserts the captured image into the test log.

JavaScript, JScript

function TestProc()
{
  var w = Sys.Desktop.Picture();
  Log.Picture(w, "Screen Image");
}

Python

def TestProc():
  w = Sys.Desktop.Picture()
  Log.Picture(w, "Screen Image")

VBScript

Sub TestProc
  Set w = Sys.Desktop.Picture
  Log.Picture w, "Screen Image"
End Sub

DelphiScript

procedure TestProc;
var w : OleVariant;
begin
  w := Sys.Desktop.Picture;
  Log.Picture(w, 'Screen Image');
end;

C++Script, C#Script

function TestProc()
{
  var w = Sys["Desktop"]["Picture"]();
  Log["Picture"](w, "Screen Image");
}

Besides the Log.Picture method, each method of the Log object that posts a message of a particular type to the test log (namely, Log.Message, Log.Warning, Log.Error and Log.Event) can also post a picture along with that message. To specify the needed picture, use the Picture parameter of the corresponding method.

Highlight search results