import os
import os.path
import subprocess
# Adjust the following to your setup/needs:
# In or relative to test suite folder:
#msi_file = squishinfo.testCase + "\\..\\putty-0.67-installer.msi"
# In or relative to current user's downloads folder:
msi_file = os.path.expanduser("~\\Downloads\\putty-0.67-installer.msi")
def main():
global installer_file_path
global installer_file_name
test.startSection("Register msiexec.exe as AUT")
try:
msiexec_path = os.path.join(os.getenv("WINDIR"), "system32")
args = [os.path.join(os.getenv("SQUISH_PREFIX"), "bin", "squishserver"), "--config", "addAUT", "msiexec", msiexec_path]
test.log("Executing: %s" % args)
output, exit_code = os_capture(args)
if exit_code != 0:
test.fatal("Registering installer as AUT failed:")
test.fatal("Output: %s" % output)
return
finally:
test.endSection()
test.startSection("Start msiexec.ece as AUT to install our .msi")
try:
startApplication('msiexec /i "%s"' % msi_file)
finally:
test.endSection()
# Execute to this line, then start
# recording a snippet (Run > Record Snippet):
test.breakpoint()
def os_capture(args, cwd=None):
if cwd is None:
cwd = os.getcwd()
proc = subprocess.Popen(
args=args,
cwd=cwd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout = proc.communicate()[0]
return stdout, proc.returncode