Forum Discussion

itvrdeich's avatar
itvrdeich
Contributor
14 years ago

Automatically Installing Tested Applications.

Hi,



Every time i run my tests i run these on a clean system. This means at the moment i need to install my tested applications on the machine before the tests run.

Is there a way i can automatically run these installers? They are WiX installers.



Cheers.

7 Replies

  • 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.

  • Thanks. 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.

  • Hi, How do i create a command line from a test complete script? 
  • 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).

  • 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)