DDT.CloseDriver Method

Applies to TestComplete 15.0, last modified on November 17, 2021

Description

Call the CloseDriver method to release resources associated with the specified driver and close the driver’s connection to the data.

Declaration

DDT.CloseDriver(Name)

Name [in]    Required    String    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Name

Specifies the name of the desired driver.

Result Value

None.

Remarks

The DDT object is only available if the Data-Driven Testing plugin is installed.

When working with Excel drivers, it is recommended to always finalize the work by calling the CloseDriver method. See Using DDT Drivers for more information.

Example

The code below creates a new Excel driver, uses it to iterate through the specified file's records and then closes the driver's access to the file's data by using the CloseDriver method.

JavaScript, JScript

function TestDriver()
{
  // Creates a driver
  // If you connect to an Excel 2007 sheet, use the following method call:
  // Driver = DDT.ExcelDriver("C:\\MyFile.xlsx", "Sheet1", True);
  Driver = DDT.ExcelDriver("C:\\MyFile.xls", "Sheet1");
  
  // Iterates through records
   
  // Closes the driver
  DDT.CloseDriver(Driver.Name);
  
}

Python

def TestDriver():
  # Creates a driver
  # If you connect to an Excel 2007 sheet, use the following method call:
  # Driver = DDT.ExcelDriver("C:\\MyFile.xlsx", "Sheet1", True)
  Driver = DDT.ExcelDriver("C:\\MyFiles\\MyFile.xls", "Sheet1")
  # Iterates through records
  # Closes the driver
  DDT.CloseDriver(Driver.Name)

VBScript

Sub TestDriver
  Dim Driver
  
  ' Creates a driver
  ' If you connect to an Excel 2007 sheet, use the following method call:
  ' Set Driver = DDT.ExcelDriver("C:\MyFile.xlsx", "Sheet1", True)
  Set Driver = DDT.ExcelDriver("C:\MyFile.xls", "Sheet1")
  
  ' Iterates through records
   
  ' Closes the driver
  Call DDT.CloseDriver(Driver.Name)
  
End Sub

DelphiScript

function TestDriver;
var Driver;
begin

  // Creates a driver
  // If you connect to an Excel 2007 sheet, use the following method call:
  // Driver := DDT.ExcelDriver('C:\MyFile.xlsx', 'Sheet1', True);
  Driver := DDT.ExcelDriver('C:\MyFile.xls', 'Sheet1');
  
  // Iterates through records
   
  // Closes the driver
  DDT.CloseDriver(Driver.Name);
  
end;

C++Script, C#Script

function TestDriver()
{
  // Creates a driver
  // If you connect to an Excel 2007 sheet, use the following method call:
  // Driver = DDT["ExcelDriver"]("C:\\MyFile.xlsx", "Sheet1", True);
  Driver = DDT["ExcelDriver"]("C:\\MyFile.xls", "Sheet1");
  
  // Iterates through records
   
  // Closes the driver
  DDT["CloseDriver"](Driver.Name);
  
}

See Also

Using DDT Drivers
Data-Driven Testing - Basic Concepts
Data-Driven Testing - Retrieving Input Data From Storage

Highlight search results