51Testing软件测试论坛

标题: 请问怎样将已经存到QC当中的QTP脚本,直接批量另存到本地? [打印本页]

作者: Diana_zhaozhao    时间: 2011-8-24 20:17
标题: 请问怎样将已经存到QC当中的QTP脚本,直接批量另存到本地?
一个一个的打开再另存为本地,实在是太麻烦了!可不可以批量另存?
作者: Diana_zhaozhao    时间: 2011-10-19 15:39
求助啊!两个月了,难道真的不能实现么?难道真的要向HP提意见了?
作者: 木卫十二    时间: 2011-12-6 09:57
同求,的确是个很麻烦的问题
作者: 木卫十二    时间: 2011-12-6 11:18
本帖最后由 木卫十二 于 2011-12-6 11:19 编辑

查了下,可以通过类似如下的脚本实现(在帮助文档中找checkout Method)。但不知道库文件能否用这种自动化的方式实现上传下载?

因为库文件很多,在QC上修改很不方便。

  1. '************************************************************************************************************************
  2. 'Description:
  3. '
  4. 'This example connects to a Quality Center project, opens a test (checks it out, if applicable),
  5. 'updates the Active Screen values and test object descriptions, and, if applicable,
  6. 'checks the modified test back into the Quality Center project.
  7. '
  8. 'Assumptions:
  9. 'The test1 test is not already checked out.
  10. 'There is no unsaved test currently open in QuickTest.
  11. 'For more information, see the example for the Test.SaveAs method.
  12. 'When QuickTest opens, it loads the add-ins required for the test.
  13. 'For more information, see the example for the Test.GetAssociatedAddins method.
  14. '************************************************************************************************************************

  15. Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
  16. Dim qtUpdateRunOptions 'As QuickTest.UpdateRunOptions ' Declare an Update Run Options object variable
  17. Dim qtRunResultsOptions 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
  18. Dim blsSupportsVerCtrl ' Declare a flag for indicating version control support

  19. Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
  20. qtApp.Launch ' Start QuickTest
  21. qtApp.Visible = True ' Make the QuickTest application visible

  22. ' Make changes in a test on Quality Center with version control
  23. qtApp.TDConnection.Connect "http://qcserver/qcbin", _
  24.               "MY_DOMAIN", "My_Project", "James", "not4you", False ' Connect to Quality Center

  25. If qtApp.TDConnection.IsConnected Then ' If connection is successful
  26.     blsSupportsVerCtrl = qtApp.TDConnection.SupportVersionControl ' Check whether the project supports version control

  27.     qtApp.Open "[QualityCenter] Subject\tests\test1", False ' Open the test
  28.     If blsSupportsVerCtrl Then ' If the project supports version control
  29.         qtApp.Test.CheckOut ' Check out the test
  30.     End If

  31.     ' Prepare the UpdateRunOptions object
  32.     Set qtUpdateRunOptions = CreateObject("QuickTest.UpdateRunOptions") ' Create the Update Run Options object
  33.     ' Set the Update Run options: update the Active Screen and test object descriptions. Do not update checkpoint values
  34.     qtUpdateRunOptions.UpdateActiveScreen = True
  35.     qtUpdateRunOptions.UpdateCheckpoints = False
  36.     qtUpdateRunOptions.UpdateTestObjectDescriptions = True

  37.     ' Prepare the RunResultsOptions object
  38.     Set qtRunResultsOptions = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
  39.     qtRunResultsOptions.ResultsLocation = "<TempLocation>" ' Set a temporary results location

  40.     'Update the test
  41.     qtApp.Test.UpdateRun qtUpdateRunOptions, qtRunResultsOptions ' Run the test in Update Run mode
  42.     qtApp.Test.Description = qtApp.Test.Description & vbNewLine & _
  43.                               "Updated: " & Now ' Document the update in the test's description (Test Settings > Properties node)

  44.     qtApp.Test.Save ' Save the test

  45.     If blsSupportsVerCtrl And qtApp.Test.VerCtrlStatus = "CheckedOut" Then ' If the test is checked out
  46.         qtApp.Test.CheckIn ' Check it in
  47.     End If

  48.     qtApp.TDConnection.Disconnect ' Disconnect from Quality Center
  49. Else
  50.     MsgBox "Cannot connect to Quality Center" ' If connection is not successful, display an error message.
  51. End If

  52. qtApp.Quit ' Exit QuickTest
  53. Set qtUpdateRunOptions = Nothing ' Release the Update Run Options object
  54. Set qtRunResultsOptions = Nothing ' Release the Run Results Options object
  55. Set qtApp = Nothing ' Release the Application object



复制代码





欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2