gpt4 book ai didi

hp-uft - HP UFT - 向所有现有脚本添加新的恢复场景

转载 作者:行者123 更新时间:2023-12-02 07:42:37 24 4
gpt4 key购买 nike

我最近创建了一个新的恢复场景,我们希望将其添加到数百个现有的运行脚本中。

不幸的是,将其设置为包含在默认值中仅适用于新脚本创建,并且不会将其追溯添加到所有现有脚本中。

我已询问 HP 支持,他们建议您需要将其添加到每个脚本的测试设置|恢复中的每个脚本中。我已要求他们将其列为 future 版本的功能请求,希望这能够实现并为将来的人们提供帮助。

我们现在想要做的是创建一个函数或脚本,我们可以在质量中心列出文件夹并浏览其中的所有脚本并更新它们。

但是,我们注意到在运行时 checkout 脚本、编辑脚本并 checkin 脚本不起作用,因为 Quality Center 似乎以只读方式运行所有脚本。

是否有其他方法可以添加恢复场景,更重要的是,将其保存到脚本中?

我发现您可以在运行时动态添加恢复方案,但问题是,恢复方案在同一次运行中不起作用,只能在下一次运行中起作用,因此脚本必须完全停止并重新启动每个脚本的每一次。

感谢任何帮助。谢谢

最佳答案

Sub test()
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True

qtApp.TDConnection.Connect "http://qcserver/qcbin", _
"MY_DOMAIN", "My_Project", "USER_NAME", "PASSWORD", False
blsSupportsVerCtrl = qtApp.TDConnection.SupportVersionControl ' Check whether the project supports version control

Recovery_scenario_path = "[ALM\Resources] Resources\Subject\Library\Recovery.qrs"

Set testF = qtApp.TDconnection.TestFactory
Set tFilter = testF.Filter
tFilter.Filter("TS_TYPE") = "QUICKTEST_TEST"

Set tList = tFilter.NewList()
For Each aT In tList
Set folderF = qtApp.TDconnection.TestFolderFactory
Set fFilter = folderF.Filter
fFilter.Filter("AL_ITEM_ID") = aT.FolderID

test_script_path = ""

Set fList = fFilter.NewList()
If fList.count = 1 Then
test_script_path = fList(1).Path & "\" & aT.Name
Else
MsgBox "Unable to determine the test script path"
Exit Sub
End If

qtApp.Open "[ALM\Subject] " & test_script_path ' Test path in HP ALM
If blsSupportsVerCtrl Then ' If the project supports version control
qtApp.test.CheckOut ' Check out the test
End If

Set qtTestRecovery = qtApp.test.Settings.Recovery

If qtTestRecovery.Count > 0 Then ' If there are any default scenarios specified for the test
qtTestRecovery.RemoveAll ' Remove them
End If

qtTestRecovery.Add Recovery_scenario_path, "ScenarioName1", 1
qtTestRecovery.Add Recovery_scenario_path, "ScenarioName2", 2 '
qtTestRecovery.Add Recovery_scenario_path, "ScenarioName3", 3
qtTestRecovery.Add Recovery_scenario_path, "ScenarioName4", 4
qtTestRecovery.Add Recovery_scenario_path, "ScenarioName5", 5

For intIndex = 1 To qtTestRecovery.Count ' Iterate the scenarios
qtTestRecovery.Item(intIndex).Enabled = True ' Enable each Recovery Scenario (Note: the 'Item' property is default and can be omitted)
Next

qtTestRecovery.Enabled = True
qtTestRecovery.SetActivationMode "OnError"
qtApp.test.Save

If blsSupportsVerCtrl And qtApp.test.VerCtrlStatus = "CheckedOut" Then ' If the test is checked out
qtApp.test.CheckIn ' Check it in
End If
Next
qtApp.TDConnection.Disconnect
qtApp.Quit
Set App = Nothing
End Sub

关于hp-uft - HP UFT - 向所有现有脚本添加新的恢复场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40985041/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com