excel - 通过测试 ID 从 Excel 执行 alm 中的测试用例

标签 excel alm hp-quality-center vba

我正在尝试通过 Excel 宏执行 QC ALM 中的测试用例。我可以访问测试列表中的测试,但无法通过其 ID 找到需要执行的特定测试用例。

下面是我正在使用的示例代码:

Set tsTreeMgr = tdConnection.testsettreemanager
Set tsFolder = tsTreeMgr.NodeByPath(nPath)
' --Search for the test set passed as an argument to the example code
Set tsList = tsFolder.FindTestSets("Test Set Name")

'------Accessing the Test Cases inside the Test SEt ----

Set theTestSet = tsList.Item(1)
For Each testsetfound In tsList
    Set tsFolder = testsetfound.TestSetFolder
    Set tsTestFactory = testsetfound.tsTestFactory
    Set tsTestList = tsTestFactory.NewList("")

    For Each tsTest In tsTestList
        MsgBox (tsTest.Name+","+ tsTest.ID)
        testrunname = "Test Case name from excel sheet"
        '----Accesssing the Run Factory ---
        Set RunFactory = tsTest.RunFactory
        Set obj_theRun = RunFactory.AddItem(CStr(testrunname))
        obj_theRun.Status = "Passed"
        obj_theRun.Post
    Next
Next

任何帮助让测试实验室的测试集中的测试用例执行都会有很大的帮助。

最佳答案

我认为您正在寻找 TSTest 对象的 TestId 属性。因此,在循环中,您可以只测试 TestId 是否与 Excel 中的值匹配:

If tsTest.TestId = testidfromexcel Then
    ' do something
End If

或者您可以使用过滤器仅从测试集中获取与 Excel 中相应测试 ID 匹配的 TSTest 实例:

Set testSetFilter = tsTestFactory.Filter
testSetFilter.Filter("TC_TEST_ID") = testidfromexcel
Set tsTestList = testSetFilter.NewList()

现在,您的 tsTestList 应仅包含来自 Excel 中 ID 的测试的测试实例。

关于excel - 通过测试 ID 从 Excel 执行 alm 中的测试用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40499796/

相关文章:

vba - 如何使用VBA查找一个范围是否包含在另一个范围中?

vba - 防止Excel中单元格大小调整

excel - 使用 UTF-8 编码的 VBA Excel 宏写入文件

excel - ActiveX 组件无法创建对象 : 'TDApiOle80.TDConnection'

git - 如何使用 TFS 2013 GIT 存储库和分支处理一组复杂的相关项目?

c# - 将 C# 动态与 COM 对象一起使用会为已实现接口(interface)的记录方法抛出 RuntimeBinderException

python - 尝试安装 Python - excel 读取包

python - 需要使用 Python 脚本从 Linux 机器连接 HP QC

testing - 将测试用例和缺陷从 Quality Center 迁移到 TFS 2008/2010

java - QC ALM ( QC 11) 身份验证时 REST Api 400 错误