CSVDriver method to create a DDT driver for a CSV file that contains values separated with the predefined delimiter character. You can use this driver to iterate through the lines of the file, obtain values stored in these lines and use these values in your data-driven tests. The driver assumes the first line of the file holds the column names (see Using DDT Drivers).
The method is applied to the following object:
The method has the following parameter:
The fully qualified name of the desired CSV file.
DDTDriver object that provides access to data stored in the specified CSV file.
DDT object is only available if the Data-Driven Testing plugin is installed.
For information on working with DDT drivers, see Using DDT Drivers.
For information on specifics and limitations of the CSV DDT driver, see Using CSV Files as Data Storages.
The code below creates a CSV driver, uses this driver to iterate through a file's contents and then closes the driver's access to the file's data.
def CSVDriverExample(): # Creates a driver DDT.CSVDriver("C:\\MyFiles\\MyFile.txt") # Iterates through records while not DDT.CurrentDriver.EOF(): # ... DDT.CurrentDriver.Next() # Closes the driver DDT.CloseDriver(DDT.CurrentDriver.Name)