QTP_Python 运行QTP

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:\\Test\\testFlight")
# 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\\testFlight\\Res1"
qtp.Test.Run(qtResultsOpt)
print "Test has %s" %qtp.Test.LastRunResults.Status
# close the Test
qtp.Test.Close()
# quit QTP
qtp.Quit()

你可能感兴趣的:(c,python,UP,Path,import)