Run 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 Run method runs the given job and thus runs all the enabled tasks of the job.

Declaration

JobObj.Run(WaitForCompletion)

JobObj An expression, variable or parameter that specifies a reference to a Job object
WaitForCompletion [in]    Required    Boolean    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

WaitForCompletion

Specifies whether the job will be run simultaneously with the entire script execution flow. If this parameter is False, the script execution will be suspended until the job's initialization finishes, then it will be resumed right after the job is started. If WaitForCompletion is True, the script execution will be suspended until the job execution is over.

Result Value

None.

Remarks

You cannot run the job, if a task of another job is running.

You cannot run the job from event handlers.

If you use network suite variables to exchange data between slave projects, run the job with the WaitForCompletion parameter set to True. Otherwise, the network suite variables may be shared among the projects incorrectly.

Example

The following script runs all the jobs (except for the last one) belonging to the network suite.

JavaScript, JScript

function Test()
{
  for (var i = 0; i < NetworkSuite.Jobs.Count - 1; i++)
    NetworkSuite.Jobs(i).Run(true);
}

Python

def Test():
  Count = NetworkSuite.Jobs.Count - 1
  for i in range(1, Count):
    NetworkSuite.Jobs[i].Run(True)

VBScript

Sub Test
  For i = 0 To NetworkSuite.Jobs.Count - 2
    NetworkSuite.Jobs(i).Run(True)
  Next
End Sub

DelphiScript

procedure Test;
var i : OleVariant;
begin
  for i := 0 to NetworkSuite.Jobs.Count - 2 do
    NetworkSuite.Jobs[i].Run(True);
end;

C++Script, C#Script

function Test()
{
  for (var i = 0; i < NetworkSuite["Jobs"]["Count"] - 1; i++)
    NetworkSuite["Jobs"](i)["Run"](true);
}

See Also

Distributed Testing
Job.Verify
Job.Stop
Job.State
Job.WaitForState
Run Method

Highlight search results