Stop Method

Applies to TestComplete 15.47, last modified on January 20, 2023
The Network Suite functionality is deprecated. We don’t recommend using it for distributed testing. Consider using a CI/CD system for managing distributed tests. See Migrating Distributed Tests to CI/CD Systems for details. In case you need to run web tests on multiple environments in parallel, you can also try using your project’s Execution Plan.

Description

The Stop method stops executing the given job unconditionally.

Declaration

JobObj.Stop()

JobObj An expression, variable or parameter that specifies a reference to a Job object
Result None

Applies To

The method is applied to the following object:

Result Value

None.

Remarks

You cannot stop the job from the OnNetJobStateChange, OnNetSuiteStateChange and OnNetTaskStateChange event handlers.

Example

The following script stops job execution if it does not stop at the specified time.

JavaScript, JScript

function StopJobExample()
{
  // Specifies the name of a job
  var jName = "Job_Name";
  // Obtains the job by its name
  var Job = NetworkSuite.Jobs.ItemByName(jName);
  // ...
  if (! Job.WaitForState(ns_Idle, 600000) ) then
    Job.Stop();

}

Python

def StopJobExample():
  # Specifies the name of a job
  jName = "Job_Name"
  # Obtains the job by its name
  Job = NetworkSuite.Jobs.ItemByName[jName]
  # ...
  if not Job.WaitForState(ns_Idle, 600000):
    Job.Stop()

VBScript

Sub StopJobExample()

  ' Specifies the name of a job
  jName = "Job_Name"
  ' Obtains the job by its name
  Set Job = NetworkSuite.Jobs.ItemByName(jName)
  ' ...
  If Not Job.WaitForState(ns_Idle, 600000) Then
    Job.Stop
  End If

End Sub

DelphiScript

function StopJobExample;
var jName, Job;
begin

  // Specifies the name of a job
  jName := 'Job_Name';
  // Obtains the job by its name
  Job := NetworkSuite.Jobs.ItemByName[jName];
  // ...
  if not Job.WaitForState(ns_Idle, 600000) then
    Job.Stop;

end;

C++Script, C#Script

function StopJobExample()
{
  // Specifies the name of a job
  var jName = "Job_Name";
  // Obtains the job by its name
  var Job = NetworkSuite["Jobs"]["ItemByName"](jName);
  // ...
  if (! Job["WaitForState"](ns_Idle, 600000) ) then
    Job["Stop"]();

}

See Also

Distributed Testing
Job.Run
Job.State
Job.WaitForState

Highlight search results