Diana_zhaozhao 发表于 2011-8-24 20:17:00

请问怎样将已经存到QC当中的QTP脚本,直接批量另存到本地?

一个一个的打开再另存为本地,实在是太麻烦了!可不可以批量另存?

Diana_zhaozhao 发表于 2011-10-19 15:39:16

求助啊!两个月了,难道真的不能实现么?难道真的要向HP提意见了?

木卫十二 发表于 2011-12-6 09:57:58

同求,的确是个很麻烦的问题

木卫十二 发表于 2011-12-6 11:18:10

本帖最后由 木卫十二 于 2011-12-6 11:19 编辑

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

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

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

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

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

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

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

    qtApp.Open " Subject\tests\test1", False ' Open the test
    If blsSupportsVerCtrl Then ' If the project supports version control
      qtApp.Test.CheckOut ' Check out the test
    End If

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

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

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

    qtApp.Test.Save ' Save the test

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

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

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



页: [1]
查看完整版本: 请问怎样将已经存到QC当中的QTP脚本,直接批量另存到本地?