First Method

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

This method is used for iterating through records of the data storage to which the ProgObj driver provides access. First moves the driver to the first record of the data storage.

Declaration

ProgObj.First()

ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
Result None

Applies To

The method is applied to the following objects:

Result Value

None.

Example

The following code demonstrates how you can change the driver and repeat a test in case of an error:

JavaScript, JScript

...
 
// Obtains a driver
var Driver = DDT.ExcelDriver("..//..//MyTestBook.xlsx", "TestSheet", true);

// Run some test with the driver
Result = MyTestRoutine(Driver);
  
// If an error occurs ...
if(! Result)
{
  Driver.First(); // Go to the first record
  MyTestRoutine(Driver); // and repeat the test
}
 
...

Python

# ...
# Obtains a driver
Driver = DDT.ExcelDriver("..//..//MyTestBook.xlsx", "TestSheet", True)
# Run some test with the driver
Result = MyTestRoutine(Driver)
# If an error occurs ...
if not Result:
  Driver.First() # Go to the first record
  MyTestRoutine(Driver) # and repeat the test
# ...

VBScript

...
 
' Obtains a driver
Set Driver = DDT.ExcelDriver("../../MyTestBook.xlsx", "TestSheet", True)

' Run some test with the driver
Result = MyTestRoutine(Driver)
  
' If an error occurs ...
If Not Result Then 
  Driver.First ' Go to the first record
  Call MyTestRoutine(Driver) ' and repeat the test
End If
 
...

DelphiScript

var
  Driver, Result : OleVariant;
begin
 
  ...
 
  // Obtains a driver
  Driver := DDT.ExcelDriver('../../MyTestBook.xlsx', 'TestSheet', true);

  // Run some test with the driver
  Result := MyTestRoutine(Driver);
  
  // If an error occurs ...
  if not Result then
  begin
    Driver.First(); // Go to the first record
    MyTestRoutine(Driver); // and repeat the test
  end;
 
  ...
 
end;

C++Script, C#Script

...
 
// Obtains a driver
var Driver = DDT["ExcelDriver"]("..//..//MyTestBook.xlsx", "TestSheet", true);

// Run some test with the driver
Result = MyTestRoutine(Driver);
  
// If an error occurs ...
if(! Result)
{
  Driver["First"](); // Go to the first record
  MyTestRoutine(Driver); // and repeat the test
}
 
...

See Also

Using DDT Drivers
DDTDriver Object
ADODriver Object
Next Method
EOF Method

Highlight search results