What should I do if the sDir and sCmdLine values of my recovery system differ from machine to machine?
This can sometimes be the case if the application under test is located in different locations throughout your testing machines.
This will occur if using Microsoft Click Once Smart Client technology. When the application is launched, the "Click Once Framework" launches the applications after downloading updated versions of the assemblies. Then the executables are launched. This causes the executables to be specific to a machine / user environment.
A workaround is to place the executable path and command line to invoke the application in a text file inside the specific users "My Documents" folder.
Here we have two variables (sDirVariable and sPathVariable) which get their values returned from two separate functions (GetsCmdLine and GetsDir), that open individual text files to retrieve the working directory and command line of the application under test.
The two files will be like so
The "FileReadLine" function will read the paths from the text files and place them in the SDir and cCmdLine variables.
[ ] const wMainWindow = TestApplication [ ] [ ] STRING sDirVariable = GetsDir() [ ] STRING sPathVariable = GetsCmdLine () [ ] [-] STRING GetsDir () [ ] HFILE hFile [ ] STRING sLine [ ] [ ] hFile = FileOpen ("C:\Documents and Settings\moreilly\My Documents\MyDirectory.txt", FM_READ) [ ] FileReadLine (hFile, sLine) [ ] FileClose (hFile) [ ] return sLine [ ] [-] STRING GetsCmdLine () [ ] HFILE hFile [ ] STRING sLine [ ] [ ] hFile = FileOpen ("C:\Documents and Settings\moreilly\My Documents\MyCommandLine.txt", FM_READ) [ ] FileReadLine (hFile, sLine) [ ] FileClose (hFile) [ ] return sLine [ ] [-] window JavaMainWin TestApplication [ ] tag "Test Application" [ ] [ ] //The working directory of the application when it is invoked [ ] const sDir = sDirVariable [ ] [ ] //The command line used to invoke the application [ ] const sCmdLine = sPathVariable