我使用Interop.TDAPIOLELib.dll进行QC ALM集成但是花了太多时间来获取所有测试计划树结构

时间:2017-05-13 09:01:09

标签: vb.net interop qc

我正在使用 Interop.TDAPIOLELib.dll 进行 QC ALM 12 集成,并在我的32位窗口机器上从QC ALM 12的工具链接安装了QcConnector.exe。 / p>

我想用父文件夹层次结构获取所有TestPlan。但是花费太多时间围绕 75 QC ALM神器(包括测试计划和文件夹) 1分50秒

  Private Sub LoadQCTree()

    Dim rootNode As Object = Nothing

    _treeManager = CType(_qcConnection.TreeManager, TreeManager)

    Dim rootList As TDAPIOLELib.List = _treeManager.RootList

    Dim rNode = rootList.Item(1)

    rootNode = _treeManager.TreeRoot(rNode)

    Dim FolderList As List = rootNode.NewList()

    'Read sub node hierarchy...

    RecurseTree(CType(FolderList, List))

    ReadChildTestCases(rootNode)

 End Sub


  Private Sub RecurseTree(ByVal SubNodes As TDAPIOLELib.List)

    For Each itm As SysTreeNode In SubNodes
        Dim Description = CStr(itm.Description).Trim
        If Not Description = "" Then Description = ConvertPlain(Description).Trim
        AddNodeEntry(itm.Name, CStr(itm.NodeID), CStr(itm.Father.NodeID), "Folder", Description, Now, Now, "TestCase", "folder")

        Dim children = itm.NewList
        RecurseTree(CType(children, List))
        ReadChildTestCases(itm)

    Next

  End Sub

  Private Sub ReadChildTestCases(ByVal itm As SysTreeNode)

    Dim testFilter As TDFilter = CType(_testFactory.Filter, TDFilter)

    testFilter.Filter("TS_SUBJECT") = Chr(34) & itm.Path & Chr(34)


    Dim TestList As List = _testFactory.NewList(testFilter.Text)

    For Each test As Test In TestList
        Try
            Dim description As String = Convert.ToString(test.Field("TS_DESCRIPTION")).Trim
            If Not description = "" Then description = ConvertPlain(description).Trim
            Dim modifiedOn As Date = CDate(test.Field("TS_VTS"))
            Dim CreationDate As Date = CDate(test.Field("TS_CREATION_DATE"))
            modifiedOn = Date.SpecifyKind(modifiedOn, DateTimeKind.Local)
            CreationDate = Date.SpecifyKind(CreationDate, DateTimeKind.Local)

            Dim BaseId = test.Field("TS_BASE_TEST_ID")
            Dim type = test.Field("TS_TYPE")
            AddNodeEntry(test.Name, CStr(test.ID), CStr(itm.NodeID), "File", description, modifiedOn, CreationDate, "TestCase", type)
        Catch ex As Exception
            'Do nothing..
            'Current node will skip from the tree hierarchy

        End Try
    Next
  End Sub

并且还希望使用文件夹层次结构获取需求,但它也花费了很多时间。

因此,我将尝试使用线程来提高性能。

主题1:加载所有测试计划

线程2:加载所有要求

并运行并行但我认为不支持并行请求。因为当我获取需求时,它需要 40秒(对于30个要求),但是只需要 1分15秒同时获取并行。

请帮助我找出改善表现的方法。

可以在一次调用中获取所有测试计划树结构。

谢谢

1 个答案:

答案 0 :(得分:0)

如果您想要所有项目的要求和测试,那么将连接对象的工厂与NewList(“”)一起使用会更快。像这样的东西(这只是伪代码):

RequirementFactory factory = connection.RequirementFactory;
List reqs = factory.NewList(""); /* this is all a project's requirements */

而不是遍历层次结构并获取每个文件夹的reqs或测试。