how to read data from a csv file using Test complete
functional tool..please can anyone post the code

Answer Posted / sheeja paul

var RecNo;
// Creates the driver (main routine)
function TestCSVDriver()
{
var Driver;

Driver = DDT["CSVDriver"]("C:\\MyCSVFile.csv");

// Iterates through records
RecNo = 0;
Driver["DriveMethod"]("csvread.ProcessCSVData");

// Closing the driver
DDT["CloseDriver"](Driver["Name"]);

}

function ProcessCSVData()
{
var i;
for(i = 0; i < DDT["CurrentDriver"]["ColumnCount"]; i++)
{
Log.Message(DDT["CurrentDriver"]["ColumnName"](i));
Log.Message(DDT["CurrentDriver"]["Value"](i));
}
RecNo = RecNo + 1;
}

// Content of MyCSVFile.csv is
//Head 1,Head 2,Head 3,Head 4,Head 5
//Z1,Z2,Z3,Z4,Z5
//Y1,Y2,Y3,Y4,Y5

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is test driven development?

620


What are the different types of scripting techniques for automation testing?

552


Can we do automation testing without a framework? If yes, then why do we need a framework?

708


Hi All! Am new to Selenium and would really appreciate your help writing test cases for the following scenario: 1. Manually create 2 logins User A and User B on say, orkut.com or facebook.com. 2. Have User A invite User B as a friend. 3. Have User B accept the friend request. 4. Have User A post a comment on his own profile. 5. Have User B post a reply to that comment. 6. Each User logs out of his respective account. 7. Do not use Selenium IDE. 8. Use Selenium RC and Java.

1503


Where will you maintain information like url, login, password?

1454






Do you know what is functional testing?

580


What is the purpose of getoptions() method?

592


Tell us what is the difference between getwindowhandles() and getwindowhandle()?

510


What are the things that one should consider for selecting a project for test automation? For example, stability, etc.

1572


What is the difference between continue and next sentence?

523


Simplify the term defect severity.

510


What are the pre-requisites to start automation testing?

483


What steps are needed in developing and running a software test?

553


What kind of tests should not be automated?

559


What java api is required for generating pdf reports?

515