Forum Discussion

Jyoungfl's avatar
Jyoungfl
Occasional Contributor
15 years ago

DDT Testing

Hello,

I just recently designed a set of scripts to verify the correct properties of one of our application installers.  I'm using the DDT as way to verify a list of files and their internal versions. 

I am experiencing two issues with the DDT object with Excel.



1. " Error: The connection for viewing your linked Microsoft Excel worksheet was lost."  This was working the entire time I was writing the scripts.  It occured a couple of time while I had the sheet open and it recovered it's self on the next attempt.  However now its to a point it will not reconnect.



2.  Using the Excel Spread sheet I am passing in the path of the file from column 0 and the version number in column 2.  But when aqFileSystem["GetFileInfo"] is called it posts an error "Cannot open specified file."  I have stepped it through to make sure the variable is being filled correctly from the DDT and spread sheet.



If I copy the path value directly from the spread sheet and hard code it in place of the DDT Object it works.

"fileName =Driver.Value(0);" (Variable is filled correctly "C:\\PathToFile\\FileName", but fails in the aqFileSystem object)

 fileName ="\\PathToFile\file" (This works every time when hard coded.)






function Verify_File_Versions ()


Verify_File_Versions ()

{


var Driver = DDT["ExcelDriver"]("U:\\Source\\XperCon_Suite\\Installer\\DDTFiles\\XperConFileList.xlsx", "Sheet2",true);


var errCount = 0;


 


var fileVer, fileName;


 


 


while (!Driver.EOF())


{


fileName =Driver.Value(0);


fileVer = Driver.Value(1)


fileVerInfo = aqFileSystem["GetFileInfo"](fileName)["VersionInfo"];


verInfo = (fileVerInfo["FileMajorVersion"] +"." + fileVerInfo["FileMinorVersion"]+"." + fileVerInfo["FileBuildVersion"]+"." + fileVerInfo["FileRevisionVersion"]);


 


 


if (!fileVer == verInfo)


{


Log.Error("File Versions Mis-match Found " +fileName)


errCount = (errCount + 1)


}


 


Driver["Next"]();


 


}


 


if (!errCount == 0)


{


Log.Error("File Verison Check Failed.")


}


else Log["Message"]("File version Check Passed");


 


 


}


7 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Murugan,


     


    It looks like the target file is open in Excel when you are trying to read it using the DDT excel driver. To avoid this error, make sure that the file is not locked and that Excel is not running.


     

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    Hi Tanya,



    Thanks for the info. I have reviewed my script and found that DDT Driver is not closed in one place. Now it works fine.Thanks
  • Jyoungfl's avatar
    Jyoungfl
    Occasional Contributor
    I have found the reasons for my problems with the DDT object.  While passing in a path be sure to remove any "" from the values stored in the spread sheet.  Just thought I would share in case anyone else encouters this.



  • Jyoungfl's avatar
    Jyoungfl
    Occasional Contributor
    Yep, this was exactly the case.  Excel still had the file locked even after closing it.  Thank you.
  • abhijit_jain's avatar
    abhijit_jain
    Occasional Contributor
    Hi,



    I did not had any such issue till date, but from past week having same issue.

    I am getting below error message. I am unable to open the thread link given above.



    "The connection for viewing your linked Microsoft Excel worksheet was lost"



    Thanks,

    Abhijit
  • murugans1011's avatar
    murugans1011
    Regular Contributor
     Similar issue here.......... and the link in the above solution given by David is broken and its not opening.