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 Index
property returns the index (starting from 0) of the given job in the network suite's job collection (see Jobs Object
). This index can be used to identify the job in this collection via the Jobs.Items
property. To learn the number of jobs in this collection, use the Jobs.Count
property.
Declaration
JobObj.Index
Read-Only Property | Integer |
JobObj | An expression, variable or parameter that specifies a reference to a Job object |
Applies To
The property is applied to the following object:
Property Value
An integer value denotes the zero-based index that the given job has in the job collection of the network suite.
Example
The code below obtains a collection of jobs that belong to a network suite and then posts the name and index of each job to the test log.
JavaScript, JScript
function JobsNamesExample()
{
// Obtains information about the jobs
var Jobs = NetworkSuite.Jobs;
// Obtains the number of the jobs that belong to the network suite
var Num = Jobs.Count;
// Iterates through the jobs
for (var i = 0; i < Num; i++)
{
// Obtains the current job
var Job = Jobs.Items(i);
var Index = Job.Index;
var Name = Job.Name;
// Posts the job's name and index to the test log
Log.Message(Index + " job's name is: " + Name);
}
}
Python
def JobsNamesExample():
# Obtains information about the jobs
Jobs = NetworkSuite.Jobs
# Obtains the number of the jobs that belong to the network suite
Num = Jobs.Count
# Iterates through the jobs
for i in range(0, Num):
# Obtains the current job
Job = Jobs.Items[i]
Index = Job.Index
Name = Job.Name
# Posts the job's name and index to the test log
Log.Message(str(Index) + " job's name is: " + Name)
VBScript
Sub JobsNamesExample()
' Obtains information about the jobs
Set Jobs = NetworkSuite.Jobs
' Obtains the number of the jobs that belong to the network suite
Num = Jobs.Count
' Iterates through the jobs
For i = 0 to (Num - 1)
' Obtains the current job
Set Job = Jobs.Items(i)
Index = Job.Index
Name = Job.Name
' Posts the job's name and index to the test log
Log.Message(Index & " job's name is: " & Name)
Next
End Sub
DelphiScript
function JobsNamesExample;
var Jobs, Num, i, Job, Name;
begin
// Obtains information about the jobs
Jobs := NetworkSuite.Jobs;
// Obtains the number of the jobs that belong to the network suite
Num := Jobs.Count;
// Iterates through the jobs
for i := 0 to (Num - 1) do
begin
// Obtains the current job
Job := Jobs.Items[i];
Index := Job.Index;
Name := Job.Name;
// Posts the job's name and index to the test log
Log.Message(Index + ' job''s name is: ' + Name);
end;
end;
C++Script, C#Script
function JobsNamesExample()
{
// Obtains information about the jobs
var Jobs = NetworkSuite["Jobs"];
// Obtains the number of the jobs that belong to the network suite
var Num = Jobs["Count"];
// Iterates through the jobs
for (var i = 0; i < Num; i++)
{
// Obtains the current job
var Job = Jobs["Items"](i);
var Index = Job["Index"];
var Name = Job["Name"];
// Posts the job's name and index to the test log
Log["Message"](Index + " job's name is: " + Name);
}
}
See Also
Distributed Testing
Name Property
Jobs Object
Count Property
Items Property