Hi ,
I'm trying to do data - driven testing using excel file. I just find out the machine doesn't have office installed. Only thing it has is a excel viewer. So can I still use Excel driver in test complete to work with excel file without Excel installed? I tried but every time ending with "an attempt to work with a closed driver" error.
If answer is no, I'll switch to csv file...
Thanks,
Michael
Solved! Go to Solution.
I think if you're using the ACE driver, you need Excel installed.
I think switching to CSV, though, is better anyways. The files are more easily portable, you can actually do DIFF checking when putting them into source control a LOT easier, and you don't need a proprietary editor to edit the files.
I think if you're using the ACE driver, you need Excel installed.
I think switching to CSV, though, is better anyways. The files are more easily portable, you can actually do DIFF checking when putting them into source control a LOT easier, and you don't need a proprietary editor to edit the files.
Thanks, Robert.
I'm working on csv now. But get error msg "Cannot update, database or object is read-only."
here is my code, pretty simple one, do you see any problem..
//code
function test_csv(){
DDT.CSVDriver(Project.Variables.data_file);
while(!DDT.CurrentDriver.EOF()) // log error point to this line of code
var sub_item = DDT.CurrentDriver.Value(0);
Log.Message(sub_item);
DDT.CurrentDriver.Next()
DDT.CloseDriver(DDT.CurrentDriver.Name);
}
Thanks,
Michael
Is Project.Variables.data_file a string containing the file name or is it the actual DBTable file itself?
I tried the following:
function testSomething() { DDT.CSVDriver(Project.Variables.dbTable); while (!DDT.CurrentDriver.EOF()) { Log.Message(DDT.CurrentDriver.Value(0)); Log.Message(DDT.CurrentDriver.Value(1)); DDT.CurrentDriver.Next() } DDT.CloseDriver(DDT.CurrentDriver.Name); }
Where the variable contains the string for my CSV file. Note, I'm using a persistent variable but, so long as the variable contains a string, it works just fine. So, I would double check and make sure that what you're passing as the Project.Variable.data_file is correct.
Hi Robert,
Project.Variables.data_file has the address of the csv file.
I'm sorry, should be data_file_csv. After changed, the script just hang there when I try to run it...
And as I read the document, I need to add a schema.ini file to pair with the csv file? I created that too...
Maybe i should just use the file address directly in the script.
Michael
Hi Robert,
Seems working now.
Thanks for helping with the troubleshooting.
Regards,
Michael
@michaelzh17 wrote:
Hi Robert,
Project.Variables.data_file has the address of the csv file.
I'm sorry, should be data_file_csv. After changed, the script just hang there when I try to run it...
And as I read the document, I need to add a schema.ini file to pair with the csv file? I created that too...
Maybe i should just use the file address directly in the script.
Michael
Looking at your screenshot, the file name in data_file_csv is missing the .csv file extension. So, that may be why you're running into issues.
As for schema.ini... you don't NEED to have it... it's useful to enforce data formats, etc., as they are read from the file as well as if you're not making the first row your column names allows you to define the column names.
@michaelzh17 wrote:
Hi Robert,
Seems working now.
Thanks for helping with the troubleshooting.
Regards,
Michael
Glad it's working!
Hi Robert,
Not sure if I could ask you another question.
Can I read data from csv file for specific row instead of using 'DDT.CurrentDriver.Next();'?
Thanks,
Michael
The DDT drivers don't allow for finding information in a particular row once you've established the driver. In order to do so, you would essentially need to reconfigure the driver via the ADOCommand object to run a different SQL query... this will change the records returned to ONLY be that one record. If that's acceptable, then yes, you can do it... but if you need to be able to have access to all the records and navigate back and forth within the set of records, than no... the DDT drivers are forward only, read only cursors on the data set.