SaveDumpToFile Method

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

Description

Saves the process dump (minidump) to the specified .dmp file.

Dumps created by this method include the following information:

  • stack traces for all threads existing in the process,

  • recently unloaded modules,

  • data referenced by locals or other stack memory.

  • (optional) the entire memory of the process.

Declaration

ProgObj.SaveDumpToFile(FileNameFullMemory)

ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
FileName [in]    Required    String    
FullMemory [in]    Optional    Boolean Default value: False   
Result None

Applies To

Parameters

The method has the following parameters:

FileName

The fully-qualified path to the .dmp file to create. If the file already exists, TestComplete overwrites it.

FullMemory

Specifies whether to include the entire memory of the process in the dump.

Result Value

None.

Example

The following script waits for an application to close for 1 minute. If the application does not close, the script saves its dump to the C:\Dump.dmp file.

JavaScript, JScript

function Test()
{
  var p = Sys.Process("MyApp");

  // Do something
  // ...

  p.Close();
  if (p.Exists)
  {
    Log.Error("Application hung on close.");
    p.SaveDumpToFile("C:\\Dump.dmp");
    p.Terminate();
  }
}

Python

def Test():
  p = Sys.Process("MyApp")

  # Do something
  # ...

  p.Close()
  if (p.Exists):
    Log.Error("Application hung on close.")
    p.SaveDumpToFile("C:\\Dump.dmp")
    p.Terminate()

VBScript

Sub Test
  Dim p
  Set p = Sys.Process("MyApp")

  ' Do something
  ' ...

  Call p.Close()
  If p.Exists Then
    Call Log.Error("Application hung on close.")
    p.SaveDumpToFile("C:\Dump.dmp")
    p.Terminate
  End If
End Sub

DelphiScript

procedure Test;
var p;
begin
  p := Sys.Process('MyApp');

  // Do something
  // ...

  p.Close();
  if p.Exists then
  begin
    Log.Error('Application hung on close.');
    p.SaveDumpToFile('C:\Dump.dmp');
    p.Terminate;
  end;
end;

C++Script, C#Script

function Test()
{
  var p = Sys["Process"]("MyApp");

  // Do something
  // ...

  p["Close"]();
  if (p["Exists"])
  {
    Log["Error"]("Application hung on close.");
    p["SaveDumpToFile"]("C:\\Dump.dmp");
    p["Terminate"]();
  }
}

See Also

Creating Process Dumps During a Test Run
SaveDumpToLog Method

Highlight search results