Forum Discussion

rlent's avatar
rlent
Contributor
14 years ago

Future-proofing tested app paths

I have a tested application that has had its path changed. Rather than going into every test suite (I have a LOT of them) to update the path, I decided to future-proof this in case the path changed again.



Dim sPath

sPath = "C:\T\Path.txt"


'Override path settings if override file is available


if Utilities.FileExists(sPath) then

    Set myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctANSI)

    s = myFile.ReadLine()

    TestedApps.AsureID.Path = s

    s = myFile.ReadLine() 

    TestedApps.AsureID.FileName = s

    Call myFile.Close()

else


    if Sys.OSInfo.Windows64bit then


        TestedApps.AsureID.Path = "C:\\Program Files (x86)\\XYZ\ProgramName\\"


    Else


        TestedApps.AsureID.Path = "C:\\Program Files\\XYZ\ProgramName\\"


    end if


end if



*****

The file Path.txt has two lines, the first line is the path, the second, the name of the executable. This means I only have to change one text file if the path changes again, instead of opening up every project.

1 Reply


  • Hi Robert,





    Thank you for sharing your experience with us. You can also use an XML file or an environment variable instead of a text file. Another way is to create a script routine that will find the executable on the hard drive automatically (e.g. by using a specific Registry key).