Index: build_tools/sasview_deploy_test.au3
===================================================================
--- build_tools/sasview_deploy_test.au3	(revision 4fc7293b1e5598ffbdd4df495b5d5beda60679ce)
+++ build_tools/sasview_deploy_test.au3	(revision 4fc7293b1e5598ffbdd4df495b5d5beda60679ce)
@@ -0,0 +1,154 @@
+; ****** REMEMBER TO SWITCH OFF UAC ON TARGET MACHINE!!! *********
+;
+; This script will install, run and uninstall SasView
+; given location of the installer. The exit code of the script
+; points at failure location:
+;
+; 0 - OK
+; 1 - Installer failure
+; 2 - Problems running SasView (simple fitting)
+; 3 - Uninstaller failure
+
+#include <Constants.au3>
+#include <FileConstants.au3>
+#include <MsgBoxConstants.au3>
+#include <WinAPIFiles.au3>
+
+; Custom error handler
+;Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
+
+; Modifiable globals
+Global $fInstallerLocation = "C:\util\setupSasView.exe"
+Global $lTimeout = 10          ; 10 sec timeout for waiting on windows
+Global $lInstallTimeout = 120  ; 2 min timeout for the installation process
+
+; General globals
+Global $installerPID = 0
+
+
+;; MAIN SCRIPT
+Install()
+RunSasView()
+Uninstall()
+Exit(0)
+
+;==============================================================
+Func Install()
+   ;;;;; APPLICATION INSTALLED ;;;;;;;
+   Local $sSetupWindow = "Setup - SasView"
+
+   ; Run setup
+   if FileExists($fInstallerLocation) Then
+	  $installerPID = Run($fInstallerLocation)
+	  Assert($installerPID, 1)
+	  Sleep(1000)
+   Else
+	  ;$Error = ObjEvent(AutoIt.Error, "Setup file does not exist","123")
+	  Exit(1)
+   EndIf
+
+   ; License click through
+   Local $test = WinWaitActive($sSetupWindow, "License Agreement", $lTimeout)
+   ;ConsoleWrite("license agreement: " & $test)
+   Assert($test, 1)
+   sleep(1000)
+
+   Send("{TAB}{up}{ENTER}")
+
+   ; Location
+   Sleep(1000)
+   $test = WinWaitActive($sSetupWindow, "Select Destination Location", $lTimeout)
+   Assert($test, 1)
+   Send("{ENTER}")
+
+   ; Icons, Startup entry
+   Sleep(1000)
+   $test = WinWaitActive($sSetupWindow, "Select Additional Tasks", $lTimeout)
+   Assert($test, 1)
+   Send("{ENTER}")
+
+   ; Ready to install...
+   Sleep(1000)
+   $test = WinWaitActive($sSetupWindow, "Ready to Install", $lTimeout)
+   Assert($test, 1)
+   Send("{ENTER}")
+
+   ; Final OK on running
+   Sleep(5000)
+   $test = WinWaitActive($sSetupWindow, "Completing the SasView Setup Wizard", $lInstallTimeout)
+   Assert($test, 1)
+   Send("{ENTER}")
+   ;ConsoleWrite("Installed" & @CRLF)
+
+EndFunc
+
+
+Func RunSasView()
+   ;;;;; APPLICATION STARTED ;;;;;;;
+   ; Start app - DEBUG ONLY
+   ;;Run("C:\Program Files (x86)\SasView\SasView.exe")
+
+   ; Wait for the window
+   Sleep(1000)
+   Local $hWnd = WinWaitActive("SasView  - Fitting -", "", $lTimeout)
+   Assert($hWnd, 2)
+
+   ;;;;; Load a File
+   ; Open File Load dialog
+   Send("!{f}{ENTER}")
+   WinWaitActive("Choose a file", "", $lTimeout)
+   Assert($hWnd, 2)
+   Sleep(200)
+
+   ; Focus is in file chooser - enter filename
+   Send("C:\Program Files (x86)\SasView\test\1d_data\cyl_400_20.txt")
+   Sleep(1000)
+   Send("{ENTER}")
+
+   ;; Send file to fitting
+   ControlClick($hWnd, "Send To", 231)
+
+   ;; Choose a model
+   ControlCommand($hWnd, "", "ComboBox3", "SetCurrentSelection", 1)
+
+   ;; Calculate the model
+   ControlClick($hWnd, "Compute", 211)
+
+   ;; Close SasView
+   WinClose($hWnd)
+
+   Local $hEnd = WinWaitActive("Confirm Exit", "", $lTimeout)
+   Assert($hEnd, 2)
+   ControlClick($hEnd, "", "[CLASS:Button; INSTANCE:1]")
+
+   Local $sv_closed = WinWaitClose($hWnd, "", $lTimeout)
+   Assert($sv_closed, 2)
+
+EndFunc
+
+Func Uninstall()
+;;;;; UNINSTALL ;;;;;;;
+   $installerPID = Run("C:\Program Files (x86)\SasView\unins000.exe")
+
+   Local $sSetupWindow = "SasView Uninstall"
+
+   Local $test = WinWaitActive($sSetupWindow, "", $lTimeout)
+   Assert($test, 3)
+   Send("{TAB}{ENTER}")
+
+   WinActivate("SasView Uninstal")
+   $test = WinWaitActive($sSetupWindow, "SasView was successfully removed", $lTimeout)
+   Assert($test, 3)
+   Send("{ENTER}")
+
+EndFunc
+
+
+;;; HELPER FUNCTIONS ;;;;
+Func Assert($test, $lExitValue)
+   ;;; Asserts $test to be non-zero and exit with code $lExitValue ;;;
+   if $test == 0 Then
+	  ProcessClose($installerPID)
+	  Exit($lExitValue)
+   EndIf
+EndFunc
