In some cases, the path to the tested application may vary from one computer to another. For example, installing the 32-bit application onto the 32-bit system, application shall default to the Program Files
folder; and in case of 64-bit system, programs end up in the Program Files (x86)
folder.
Another example of using dynamic paths is testing different versions of the same application, when the application path also includes the version number.
We can simply create two copies of the tested application in TestedApps and toggle-switch each one on and off, depending on the system type. Otherwise, we could define the pathname dynamically and modify it (along the other parameters) prior to the launch.
In order to change the tested application's path we need to perform the following steps:
function testChangeAppSettings() { if(Sys.OSInfo.Windows64bit) { TestedApps.CalcPlus.Path = "C:\Program Files (x86)\Microsoft Calculator Plus"; } else { TestedApps.CalcPlus.Path = "C:\Program Files\Microsoft Calculator Plus"; } TestedApps.CalcPlus.Run(); }
Here we define the bitness of the system with the help of the Sys.OSInfo.Windows64bit
property and set the path to the tested application depending on the value of the passed variable.
In a similar manner, we can change other application parameters as well (name, parameters, and so on).
Before applying a certain property, read up on it in the reference book to make sure this property is not obsolete. Deprecated properties and methods are not recommended for use, as in the following versions of TestComplete they could be removed, for obsolescent properties and methods can be always replaced with more user-friendly alternatives.
3.133.128.145