Suspend Method

Applies to TestComplete 15.42, last modified on September 08, 2022
The manual testing functionality is deprecated. Do not use it for creating new tests. It will be removed in a future TestComplete release.

Description

The Suspend method stores data about the current state of the manual test. The manual test can be resumed starting from the step where it was interrupted.

Declaration

ManualTestingObj.Suspend(AStopTest)

ManualTestingObj An expression, variable or parameter that specifies a reference to a ManualTesting object
AStopTest [in]    Required    Boolean    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

AStopTest

Specifies whether to stop a manual test after the resume data is generated. If the value is True the test is interrupted, otherwise the test is proceeded.

Result Value

None.

Remarks

To resume an interrupted manual test use the Resume method.

Example

The following example demonstrates how you can suspend the manual test execution in your scripts. The code snippet below is a handler for the OnStepFail event. It suspends manual testing if one of the specified steps fails.

JavaScript, JScript

// Handler for the OnStepFail event
function GeneralEvents_OnStepFail(Sender, StepParams)
{
  var ID = StepParams.StepID;

  // If Step M or Step L fails ...
  if ((ID == "STEP_L") || (ID == "STEP_M"))
  {
    var Caption = ManualTests.NewManualTest.GetStepInfo(ID).GetCaption();
    ShowMessage("The test execution has been suspended at step " + Caption);
    // Clears the resume information
    ManualTests.NewManualTest.ClearResumeInfo();
    // Suspends the manual testing
    ManualTests.NewManualTest.Suspend(true);
    StepParams.StepActions = ManualTests.mtsaContinue;
  }

}

Python

def GeneralEvents_OnStepFail(Sender, StepParams):
# Handler for the OnStepFail event 
  ID = StepParams.StepID
  # If Step M or Step L fails ...
  if ID == "STEP_L" or ID == "STEP_M":
    Caption = ManualTests.NewManualTest.GetStepInfo(ID).GetCaption()
    ShowMessage("The test execution has been suspended at step " + Caption)
    # Clears the resume information
    ManualTests.NewManualTest.ClearResumeInfo()
    # Suspends the manual testing
    ManualTests.NewManualTest.Suspend(True)
    StepParams.StepActions = ManualTests.mtsaContinue

VBScript

' Handler for the OnStepFail event
Sub GeneralEvents_OnStepFail(Sender, StepParams)

  ID = StepParams.StepID

  ' If Step M or Step L fails ...
  If ID = "STEP_L" Or ID = "STEP_M" Then
    Caption = ManualTests.NewManualTest.GetStepInfo(ID).GetCaption
    ShowMessage "The test execution has been suspended at step " & Caption
    ' Clears the resume information
    ManualTests.NewManualTest.ClearResumeInfo
    ' Suspends the manual testing
    ManualTests.NewManualTest.Suspend(True)
    StepParams.StepActions = ManualTests.mtsaContinue
End If

End Sub

DelphiScript

// Handler for the OnStepFail event
procedure GeneralEvents_OnStepFail(Sender, StepParams);
var ID, Caption;
begin
  ID := StepParams.StepID;

  // If Step M or Step L fails ...
  if ((ID = 'STEP_L') or (ID = 'STEP_M')) then
  begin
    Caption := ManualTests.NewManualTest.GetStepInfo(ID).GetCaption;
    ShowMessage('The test execution has been suspended at step ' + Caption);
    // Clears the resume information
    ManualTests.NewManualTest.ClearResumeInfo;
    // Suspends the manual testing
    ManualTests.NewManualTest.Suspend(true);
    StepParams.StepActions := ManualTests.mtsaContinue;
  end;

end;

C++Script, C#Script

// Handler for the OnStepFail event
function GeneralEvents_OnStepFail(Sender, StepParams)
{
  var ID = StepParams["StepID"];

  // If Step M or Step L fails ...
  if ((ID == "STEP_L") || (ID == "STEP_M"))
  {
    var Caption = ManualTests["NewManualTest"]["GetStepInfo"](ID)["GetCaption"]();
    ShowMessage("The test execution has been suspended at step " + Caption);
    // Clears the resume information
    ManualTests["NewManualTest"]["ClearResumeInfo"]();
    // Suspends the manual testing
    ManualTests["NewManualTest"]["Suspend"](true);
    StepParams["StepActions"] = ManualTests["mtsaContinue"];
  }

}

See Also

CanResume Method
Resume Method
Executing Manual Tests

Highlight search results