PreviousStepID Property

Applies to TestComplete 15.69, last modified on November 13, 2024
The manual testing functionality is deprecated. Do not use it for creating new tests. It will be removed in a future TestComplete release.

Description

Use this property to get the identifier of a manual test step that was executed before the current test step. The step identifier is displayed in the ID field of the Manual Testing editor.

Declaration

ManualTestingGetNextStepEventParamsObj.PreviousStepID

Read-Only Property String
ManualTestingGetNextStepEventParamsObj An expression, variable or parameter that specifies a reference to a ManualTestingGetNextStepEventParams object

Applies To

The property is applied to the following object:

Property Value

The string that holds the identifier of the previous step.

Example

The following code snippet demonstrates how you can change the default steps order. If Step K fails, the code skips the steps that follow it and jumps to Step M.

JavaScript, JScript

var StepKFailed;

// Handler for the OnGetNextStep event
function GeneralEvents_OnGetNextStep(Sender, StepParams)
{
  // Obtains the ID of the previous step
  var PreviousID = StepParams.PreviousStepID;

  // If the previous step with the "STEP_K" ID has failed …
  if ((PreviousID == "STEP_K") && StepKFailed)
  {
    // The step with the "STEP_M" ID is executed
    StepParams.NextStepID = "STEP_M";
    var InfoK = ManualTests.NewManualTest.GetStepInfo("STEP_K");
    var InfoM = ManualTests.NewManualTest.GetStepInfo("STEP_M");
    ShowMessage(InfoK.GetCaption() + " has failed. " + InfoM.GetCaption() + " will be executed");
  }

}

// Handler for the OnStepFail event
function GeneralEvents_OnStepFail(Sender, StepParams)
{
  // If Step K fails, the StepKFailed value is set to true
  if (StepParams.StepID == "STEP_K")
  {
    StepKFailed = true;
    StepParams.StepActions = ManualTests.mtsaContinue;
  }

}

Python

StepKFailed = False

# Handler for the OnGetNextStep event 
def GeneralEvents_OnGetNextStep(Sender, StepParams):
  global StepKFailed
  # Obtains the ID of the previous step
  PreviousID = StepParams.PreviousStepID
  # If the previous step with the "STEP_K" ID has failed ... 
  if PreviousID == "STEP_K" and StepKFailed:
    # The step with the "STEP_M" ID is executed
    StepParams.NextStepID = "STEP_M"
    InfoK = ManualTests.NewManualTest.GetStepInfo("STEP_K")
    InfoM = ManualTests.NewManualTest.GetStepInfo("STEP_M")
    ShowMessage(InfoK.GetCaption() + " has failed. " + InfoM.GetCaption() + " will be executed")
    
# Handler for the OnStepFail event 
def GeneralEvents_OnStepFail(Sender, StepParams):
  global StepKFailed
  # If Step K fails, the StepKFailed value is set to true 
  if StepParams.StepID == "STEP_K":
    StepKFailed = True
    StepParams.StepActions = ManualTests.mtsaContinue

VBScript

Dim StepKFailed

' Handler for the OnGetNextStep event
Sub GeneralEvents_OnGetNextStep(Sender, StepParams)

  ' Obtains the ID of the previous step
  PreviousID = StepParams.PreviousStepID

  ' If the previous step with the "STEP_K" ID has failed …
  If PreviousID = "STEP_K" And StepKFailed Then
    ' The step with the "STEP_M" ID is executed
    StepParams.NextStepID = "STEP_M"
    Set InfoK = ManualTests.NewManualTest.GetStepInfo("STEP_K")
    Set InfoM = ManualTests.NewManualTest.GetStepInfo("STEP_M")
    ShowMessage InfoK.GetCaption & " has failed. " & InfoM.GetCaption & " will be executed"
  End If

End Sub

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

  ' If Step K fails, the StepKFailed value is set to True
  If StepParams.StepID = "STEP_K" Then
    StepKFailed = True
    StepParams.StepActions = ManualTests.mtsaContinue
  End If

End Sub

DelphiScript

var StepKFailed;

// Handler for the OnGetNextStep event
procedure GeneralEvents_OnGetNextStep(Sender, StepParams);
var PreviousID, InfoK, InfoM;
begin
  // Obtains the ID of the previous step
  PreviousID := StepParams.PreviousStepID;

  // If the previous step with the "STEP_K" ID has failed …
  if ((PreviousID = 'STEP_K') and StepKFailed) then
  begin
    // The step with the "STEP_M" ID is executed
    StepParams.NextStepID := 'STEP_M';
    InfoK := ManualTests.NewManualTest.GetStepInfo('STEP_K');
    InfoM := ManualTests.NewManualTest.GetStepInfo('STEP_M');
    ShowMessage(InfoK.GetCaption + ' has failed. ' + InfoM.GetCaption + ' will be executed');
  end;

end;

// Handler for the OnStepFail event
procedure GeneralEvents_OnStepFail(Sender, StepParams);
begin
  // If Step K fails, the StepKFailed value is set to true
  if StepParams.StepID = 'STEP_K' then
  begin
    StepKFailed := true;
    StepParams.StepActions := ManualTests.mtsaContinue;
  end;

end;

C++Script, C#Script

var StepKFailed;

// Handler for the OnGetNextStep event
function GeneralEvents_OnGetNextStep(Sender, StepParams)
{
  // Obtains the ID of the previous step
  var PreviousID = StepParams["PreviousStepID"];

  // If the previous step with the "STEP_K" ID has failed …
  if ((PreviousID == "STEP_K") && StepKFailed)
  {
    // The step with the "STEP_M" ID is executed
    StepParams["NextStepID"] = "STEP_M";
    var InfoK = ManualTests["NewManualTest"]["GetStepInfo"]("STEP_K");
    var InfoM = ManualTests["NewManualTest"]["GetStepInfo"]("STEP_M");
    ShowMessage(InfoK["GetCaption"]() + " has failed. " + InfoM["GetCaption"]() + " will be executed");
  }

}

// Handler for the OnStepFail event
function GeneralEvents_OnStepFail(Sender, StepParams)
{
  // If Step K fails, the StepKFailed value is set to true
  if (StepParams["StepID"] == "STEP_K")
  {
    StepKFailed = true;
    StepParams["StepActions"] = ManualTests["mtsaContinue"];
  }

}

See Also

Manual Testing
Executing Manual Tests
About Manual Test Editor
Manual Testing Events
OnGetNextStep Event

Highlight search results