Forum Discussion
7 Replies
- Abramova
Staff
Hi,
There are several approaches to install your tested application:
1. Run your MSI package from the command line.
2. Create a TestComplete script that uses the Windows Management Instrumentation (WMI) functionality to run the installation program. For more information, please read Working With WMI Objects in Scripts in the online documentation.
3. Use another SmartBear product - Automated Build Studio. This tool provides you with the Install Application (WMI) operation that lets you automate installing an application from a Windows Installer Package to a local or remote computer. - itvrdeichContributorThanks. I can install the application via the command line so thats one option for me.
But I would really rather have a script that runs at the start of all my tests which just installs all of the tested applications.
Is there an example script in C# script that shows us how to do this? I couldnt find one in your links.
I have never done this before nor have i ever used WMI so a example script would be usefull if possible?
Thanks. - Abramova
Staff
Hi Ivan,
To learn how to use WMI services in script code and find the complete WMI scripting API reference, please see the following topics in the MSDN Library:
- itvrdeichContributorHi, How do i create a command line from a test complete script?
- AlexeyK
Alumni
Ivan,
1. To run installers from the command line, you can use the following code:
Set objShell = Sys.OleObject("WScript.Shell")
objResult = objShell.Run("""C:\My Apps\My App Installer1.exe"" -cmdLineArg1 -cmdLineArg2", 1, True)For information on parameters of the Run method, see the MSDN library:
http://msdn.microsoft.com/en-us/library/d5fk67ky%28v=VS.85%29.aspx.2. A possible alternative to the scripting approach above --
* Copy the installation packages of your applications to a folder on a clean system, say, to C:\Temp\Installers.
* On your computer, add installers as tested applications to your TestComplete project and specify the C:\Temp\Installers folder as their path in the tested application settings.
* Now, after you copy the test project and installers to the clean system, you will be able to launch the installations in the same manner as you launch tested applications (TestedApps.Installer.Run). - itvrdeichContributorI dont have a exe installer. I have a MSI installer.
- AlexeyK
Alumni
Try using this code --
Set objShell = Sys.OleObject("WScript.Shell")
objResult = objShell.Run("""C:\My Apps\My App Installer.msi""", 1, True)-- or this --
Set objShell = Sys.OleObject("WScript.Shell")
objResult = objShell.Run("msiexec.exe ""C:\My Apps\My App Installer.msi"" /cmdLineArg1 /cmdLineArg2", 1, True)