'######################################################
'# FunctionName : getQCParameters
'# Purpose: To get the QC Parameters from Test cases using QTP
'# Created By : Jay
'######################################################
Function getQCParameters(strNodeByPath)
On Error Resume Next
'strNodeByPath = "Subject\02 - System Test\TestCases\Reports\Client Reports"
Set TDC = QCUtil.QCConnection
set TSfact = TDC.TestSetFactory
Set TreeMgr = TDC.TreeManager
Set TestTree = TreeMgr.NodeByPath(strNodeByPath)
Set TestFactory = TestTree.TestFactory
Set TestList = TestFactory.NewList("")
Dim NodesList()
ReDim Preserve NodesList(0)
NodesList(0) = TestTree.Path
Dim Row, Node, TestCase
irow = 1
For Each Node In NodesList
Set TestTree = TreeMgr.NodeByPath(Node)
Set TestFactory = TestTree.TestFactory
Set TestList = TestFactory.NewList("")
iCnt = TestList.Count
For i = 1 to iCnt
Set TestCase = TestList(i)
DataTable.SetCurrentRow(irow)
testcaseName = TestCase.Name
DataTable("SNO") = i
DataTable("TestcaseName") = TestCase.Name
Set DesignStepFactory = TestList(i).DesignStepFactory
Set DesignStepList = DesignStepFactory.NewList("")
idCnt = DesignStepList.Count
If idCnt <> 0 Then
For j= 1 to idCnt
ipCnt = DesignStepList(j).linkedparams.Count
templateNameArray = Split(DesignStepList(j).StepDescription, "<", -1)
templateName = Split(templateNameArray(1),">",-1)(0)
DataTable.SetCurrentRow(irow)
DataTable("TemplateName") = templateName
For k =0 to ipCnt-1
DataTable.SetCurrentRow(irow)
DataTable("Parameters") = DesignStepList(j).linkedparams.ParamName(k)
DataTable("Value") = DesignStepList(j).linkedparams.ParamValue(k)
irow = irow +1
Next
Next
End If
Next
Next
bound = Ubound(Split(NodesList(0),"\"))
Folname = Split(NodesList(0),"\")(bound)
DataTable.Export"C:\Jay_" & Folname & ".xls"
End Function
Eg:
strNodeByPath = "Subject\02 - System Test\TestCases\Reports\Security Report"
Call getQCParameters(strNodeByPath)
'# FunctionName : getQCParameters
'# Purpose: To get the QC Parameters from Test cases using QTP
'# Created By : Jay
'######################################################
Function getQCParameters(strNodeByPath)
On Error Resume Next
'strNodeByPath = "Subject\02 - System Test\TestCases\Reports\Client Reports"
Set TDC = QCUtil.QCConnection
set TSfact = TDC.TestSetFactory
Set TreeMgr = TDC.TreeManager
Set TestTree = TreeMgr.NodeByPath(strNodeByPath)
Set TestFactory = TestTree.TestFactory
Set TestList = TestFactory.NewList("")
Dim NodesList()
ReDim Preserve NodesList(0)
NodesList(0) = TestTree.Path
Dim Row, Node, TestCase
irow = 1
For Each Node In NodesList
Set TestTree = TreeMgr.NodeByPath(Node)
Set TestFactory = TestTree.TestFactory
Set TestList = TestFactory.NewList("")
iCnt = TestList.Count
For i = 1 to iCnt
Set TestCase = TestList(i)
DataTable.SetCurrentRow(irow)
testcaseName = TestCase.Name
DataTable("SNO") = i
DataTable("TestcaseName") = TestCase.Name
Set DesignStepFactory = TestList(i).DesignStepFactory
Set DesignStepList = DesignStepFactory.NewList("")
idCnt = DesignStepList.Count
If idCnt <> 0 Then
For j= 1 to idCnt
ipCnt = DesignStepList(j).linkedparams.Count
templateNameArray = Split(DesignStepList(j).StepDescription, "<", -1)
templateName = Split(templateNameArray(1),">",-1)(0)
DataTable.SetCurrentRow(irow)
DataTable("TemplateName") = templateName
For k =0 to ipCnt-1
DataTable.SetCurrentRow(irow)
DataTable("Parameters") = DesignStepList(j).linkedparams.ParamName(k)
DataTable("Value") = DesignStepList(j).linkedparams.ParamValue(k)
irow = irow +1
Next
Next
End If
Next
Next
bound = Ubound(Split(NodesList(0),"\"))
Folname = Split(NodesList(0),"\")(bound)
DataTable.Export"C:\Jay_" & Folname & ".xls"
End Function
Eg:
strNodeByPath = "Subject\02 - System Test\TestCases\Reports\Security Report"
Call getQCParameters(strNodeByPath)
Comments