Skip to content

Instantly share code, notes, and snippets.

@bulkan
Created September 18, 2009 06:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bulkan/188917 to your computer and use it in GitHub Desktop.
Save bulkan/188917 to your computer and use it in GitHub Desktop.
Python script to run a QTP test
import win32com, win32com.client
qtp = win32com.client.Dispatch("QuickTest.Application")
# starts up QTP
qtp.Launch()
# make the QTP window visible
qtp.Visible = True
# Open a test, replace the path
qtp.Open("C:\Tests\test1")
# to open a QTP test in Quality Center
# qtp.Open(r"[QualityCenter] Subject\FolderName\QTPScript")
# create a RunResultsOptions object
qtResultsOpt = win32com.client.Dispatch("QuickTest.RunResultsOptions")
# set the location to where the results will be save
qtResultsOpt.ResultsLocation = "C:\Test\test1\res"
qtp.Test.Run(qtResultsOpt)
print "Test has %s" %qtp.Test.LastRunResults.Status
# close the Test
qtp.Test.Close()
# quit QTP
qtp.Quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment