Search code examples
vb.netinterophp-quality-center

I am using Interop.TDAPIOLELib.dll for QC ALM Integration But taking too much time for getting All Test Plan Tree Structure


I am using Interop.TDAPIOLELib.dll for QC ALM 12 Integration and installed QcConnector.exe from tool link from QC ALM 12 on my 32 bit window machine.

I want to fetch all TestPlan with parent folder hierarchy . But its take too much time around 75 artifact of QC ALM (included Test Plan and Folder) taking 1 minute 50 seconds.

  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

And also want to Fetch Requirements with folder hierarchy but its also taking to much time.

So , I'll try to improve performance using thread .

Thread 1 : Load all Test Plan

Thread 2 : Load all Requirement

and run parallel but i think is not supported parallel request. Because when i fetch requirement it takes 40 second (for 30 requirements) but fetch both parallel taking 1 minute 15 second for only requirements .

Please Help me to find out the way to how improve performance .

It is possible to get all test plan tree structure in one call.

Thanks


Solution

  • If you want all a project's requirements and tests then it is faster to use the connection object's factories with NewList(""). Something like this (this is just pseudo-code):

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

    Instead of walking the hierarchy and getting the reqs or tests for each folder.