API - Creating test set - Error - ReleaseSemaphore

Options

I am trying to add a test set to a folder in testlab using a VB interface.   I am able to add a folder successfully.  When I try to add a test set, it fails with the exception 'ReleaseSemaphore failed'.   I have searched the Internet for more information but there is very little and nothing that helped.

 

I am using ALM 11.52.580.0,  Windows 7, and Visual Studio 12.0 Professional.  I am working from code that I found in my search, but also referenced code and sections in the API reference.   I have added a reference to the OTA COM Type Library to my project, so I am also working with the object explorer to help me figure things out.

 

I am new to using the API interface, so part of my difficulty may be that I do not know the appropriate question(s) to ask.   Any help anyone can provide will be greatly appreciated!   Thank you!

 

   Private Sub cmdAddTest_Click(sender As Object, e As EventArgs) Handles cmdAddTest.Click

 

       Dim ota As New OTAAPIActions

       Dim dt As String = Now.Hour.ToString.PadLeft(2, "0"c) _

& Now.Minute.ToString.PadLeft(2, "0"c) _

& Now.Second.ToString.PadLeft(2, "0"c)

       ota.AddTestLabFolder("SmokeTest" & dt)

       ota.disconnect()

       Thread.Sleep(500)

 

       ota.AddTestSet("SmokeTest" & dt, "Test" & dt)

       ota.disconnect()

 

   End Sub

 

   Public Function AddTestLabFolder(ByVal TestFolderName As String) As String

 

       'Add tests to a Folder (say..."MainFolder") under Subject node in TestPlan

       ' connect to Quality Center

       m_conn = New TDConnection

       m_conn.InitConnectionEx("****")

       m_conn.Login("****", "****")

       m_conn.Connect("****", "****")

 

       Dim TreeManager, root, folder1

 

       ' Add a Test Set Folder in Test Lab

       TreeManager = m_conn.TestSetTreeManager

       root = TreeManager.Root

       folder1 = TreeManager.NodeByPath("Root\WebFastest Automation")

       folder1.AddNode(TestFolderName) ' name of the Test Set Folder

       root = Nothing

       TreeManager = Nothing

       MessageBox.Show("Added :" & "Root\WebFastest Automation\" & TestFolderName)

       Return Nothing

 

   End Function

 

 

   Public Function AddTestSet(ByVal TestLabFolder As String, ByVal TestSetName As String)

 

       m_conn = New TDConnection

       m_conn.InitConnectionEx("****")

       m_conn.Login("****", "****")

       m_conn.Connect("****", "****")

 

        'Dim testSetFolder As TestSetFolder = Nothing

       Dim testSetFolderF As TestSetTreeManager = Nothing

       'Dim testSetF As TestSetFactory

       'Dim testSet1 As TestSet

 

       Try

           testSetFolderF = m_conn.TestSetTreeManager

 

          Dim testSetFolder As TestSetFolder = testSetFolderF.NodeByPath("Root\WebFastest Automation")

           Dim testSetFactory As TestSetFactory = testSetFolder.TestSetFactory

           Dim testSet1 As TestSet = testSetFactory.AddItem(vbNull)

 

          testSet1.Name = TestSetName

           testSet1.status = "Open"

           testSet1.Post()

           testSet1.UnLockObject()

 

           Return True

 

       Catch ex As Exception

           MessageBox.Show(ex.Message & "/" & ex.HResult.ToString, "AddTestSet", MessageBoxButtons.OK)

       End Try

 

   End Function

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs