QTP_Python 运行QTP

来源:互联网 发布:java程序员兼职群 编辑:程序博客网 时间:2024/05/20 19:32
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()
原创粉丝点击