我正在研究 QTP 上的 BPT 框架,对于一个测试用例,我多次使用相同的组件。我想从 QC ->Testplan->TestCase->Business 组件中获取业务组件实例号。根据实例编号,我将从 excel 表中读取所需的组件参数。
谢谢。
我正在研究 QTP 上的 BPT 框架,对于一个测试用例,我多次使用相同的组件。我想从 QC ->Testplan->TestCase->Business 组件中获取业务组件实例号。根据实例编号,我将从 excel 表中读取所需的组件参数。
谢谢。
下面的代码对我有用:
Set TestTree = TestSet.TSTestFactory
Set TestList = TestTree.NewList("")
For Each TSTest In TestList
Set Test = TSTest.Test
Set objTestFactory = tdc.TestFactory
Set tFilter = objTestFactory.Filter
tFilter.Filter("TS_TEST_ID") = Test.ID
Set tList = objTestFactory.NewList(tFilter.Text)
Dim objTest
For Each tst In tList
If tst.Type = "BUSINESS-PROCESS" Then
Set objTest = tst
Exit For
End If
Next
If objTest Is Nothing Then
Else
Dim BPTest As BusinessProcess
Set BPTest = objTest
BPTest.Load
' Get list if component instance from the Test
Set components = BPTest.BPComponents
Set Component = components.Item(1)
For i = 1 To BPTest.BPComponents.Count
componentName = components.Item(i).Name
componentInstanceId = components.Item(i).ID
ComponentId = components.Item(i).Component.ID
Next
End if
Next
此代码将从测试实验室级别获取详细信息,并一直到业务组件级别。目前它正在提取组件名称和 ID。您可以根据需要修改代码。
访问knowlzz上的教程。它用每一个细节很好地解释了解决方案。