Forum Discussion

marin's avatar
marin
Frequent Contributor
12 years ago

DDT Excel driver will not detect end of file

Hello all,



I have a strange problem in my data driven testing project - it seems as if DDT Excel driver can not find the end of file in some cases.



I am using following code:







var inputData = DDT.ExcelDriver(strTestDataExcelFile,"myWorksheet",true);


while(!inputData.EOF())



{

  doing test steps here...; 

  inputData.Next();

}








Loop works fine for all data rows in the worksheet and my tests steps are processed OK.



Now when last row with data is reached and processed, the loop does not seem to recognize that inputData.EOF() is true -> it always evaluates to false (added to watch and inspected while debugging). Basically, the loop executes once more after the last row of data has been (successfuly) processed -> this causes a runtime error because the object  referenced in the test step does not exist then:



inputData.Value("Last Name")



For some other Excel file (different tests) EOF is recognized OK.



I have tried to make completely new Excel sheet and to copy only the rows with data, but to no avail -> EOF will not be recognized.



Is this a known issue or am I missing something? Any ideas where to dig?



I am using latest TestComplete (9.30) and Excel version 2010 ( test file is an .xslx file) .



Many thanks for any hints,



Marin


  • When I have had a similar problem I would highlight and delete ALL rows below the last row with data that you want in Excel. Usually there are some empty cells with no data but some formatting was applied to them.
  • paul_scroce's avatar
    paul_scroce
    Frequent Contributor
    When I have had a similar problem I would highlight and delete ALL rows below the last row with data that you want in Excel. Usually there are some empty cells with no data but some formatting was applied to them.
  • marin's avatar
    marin
    Frequent Contributor
    Hello Paul,



    many thanks for your reply, much appreciated.



    Indeed it  must have been something with formatting of empty cells - I have deleted all cells below last row and now EOF() will be recognized.



    Many thanks again,



    Marin