我的csdn博客地址: http://blog.csdn.net/blizzardlyk
QTP连接QC时,通过QCUtil对象获取QC中的Test信息
上一篇 /
下一篇 2010-08-25 11:00:46
/ 个人分类:QTP
最近几天,开始尝试QTP与QC的连接操作。
写了几个方法,来获取QTP脚本在QC中所在的不同目录的路径信息。
GetCurrentTestSet: 返回当前脚本所在的Test Set的路径名称
GetCurrentInstance: 返回当前脚本在Test Set中的步骤名称及运行时的实例名称
GetCurrentTestName: 返回当前脚本在Test Plan中的绝对路径
代码如下:
Function GetCurrentTestSet()
GetCurrentTestSet=""
'If current test set is nothing then exit
If QCUtil.CurrentTestSet is Nothing Then Exit Function
'Name of the test set
testSetName = QCUtil.CurrentTestSet.Name
'Path for the folder where the test Set exists
testSetFolder = QCUtil.CurrentTestSet.TestSetFolder.Path
'Combine the two
GetCurrentTestSet = testSetFolder & "\" & testSetName
End Function
Function GetCurrentInstance()
GetCurrentInstance=""
'If current test set is nothing then exit
If QCUtil.CurrentRun is Nothing Then Exit Function
'Name of the test Instance
Instance = QCUtil.CurrentTestSetTest.name &"->"& QCUtil.CurrentRun.name
GetCurrentInstance = Instance
End Function
Function GetCurrentTestName()
GetCurrentTestName=""
'If current test set is nothing then exit
If QCUtil.CurrentTest is Nothing Then Exit Function
'Name of the test
testname = QCUtil.CurrentTest.Field("TS_SUBJECT").Path & "\" &QCUtil.CurrentTest.name
GetCurrentTestName = testname
End Function
收藏
举报
TAG:
QTP连接QC