替换特定文件夹中的所有内容

时间:2017-01-17 14:28:01

标签: alm

在我的测试计划中,我有两个文件夹。一个包含所有活动测试用例,另一个包含所有存档测试用例。我需要将大量“受影响的模块”从一个值替换为另一个值,但是 - 我不希望存档的文件夹受此影响。

那么,有没有办法只在HP ALM中的特定文件夹(和所有子文件夹)上进行搜索和替换?

据我所知,网格视图中的搜索和替换功能会替换值的所有实例,因此我无法直接使用它。

1 个答案:

答案 0 :(得分:0)

以下是一个简单的OTA代码,用于更新文件夹ts_user_04及其子文件夹中所有测试用例的字段Subject\Automated,其值为Quoting

请根据您的要求更改列名称。如果您有权访问“管理”选项卡,则可以通过“管理”选项卡轻松找到HP ALM中任何字段的数据库列。即便如此,您也可以使用OTA获取所有映射。 (我希望你有必要的访问权限)

为了运行OTA代码,您需要安装 ALM Connectivity 加载项,您可以从ALM主页的工具部分获取

Public TDconnection
Public reqPath
Public testPath

'Call the main Function
updateAllTests



Public Function login()
    Dim almURL, almUserName, almPassword, domain, project
    almURL = "https://.saas.hp.com/qcbin/"

    almUserName = ""
    almPassword = ""
    domain = ""
    project = ""    
    testPath = "Subject\Automated" ' Change it as per your folder structure

    Set TDconnection = CreateObject("tdapiole80.tdconnection")
    TDconnection.ReleaseConnection
    TDconnection.InitConnectionEx almURL
    TDconnection.login almUserName, almPassword
    TDconnection.Connect domain, project

End Function


Public Function updateAllTests()
    login   
    Set TreeMgr = TDconnection.TreeManager
    Set TestTree = TreeMgr.NodeByPath(testPath)
    If Err.Number = 0 Then
        Set comm = TDconnection.Command
        comm.CommandText = "update test set ts_user_04='Quoting' where ts_test_id in (select ts_test_id from test, all_lists where ts_subject in (select al_item_id from all_lists where al_absolute_path like (select al_absolute_path from all_lists where al_item_id=" & TestTree.NodeID & ") || '%' ) and ts_subject = al_item_id)"
        comm.Execute
    End If
    logout
    MsgBox "Flag Update successful", vbInformation
End Function

Public Function logout()
    TDconnection.Disconnect
    TDconnection.logout
    TDconnection.ReleaseConnection
    Set TDconnection = Nothing
End Function