Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8376559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:27:25+00:00 2026-06-09T15:27:25+00:00

Working on a QC integration tool and having trouble creating a test in the

  • 0

Working on a QC integration tool and having trouble creating a test in the Test Plan – unfortunately the API is written for VB6, and I’m working in C#.

Here’s what I’ve got so far:

private void HPQC_Create_Test_Plan_Test(TDConnectionClass tdConnection, string ParentFolderPath, string TestName)
    {
        try
        {
            TreeManager treeM = (TreeManager)tdConnection.TreeManager;
            ISysTreeNode ParentFolder = (ISysTreeNode)treeM.get_NodeByPath(ParentFolderPath);
            TestFactory TestF = (TestFactory)tdConnection.TestFactory;

            Test TstTest = (Test)TestF.AddItem(System.DBNull.Value);
            TstTest.Name = TestName;
            TstTest.Type = "MANUAL";
            TstTest.Post();

            HPQC_Status_Test_Plan.Text = "Test " + TestName + " created.";

            tdConnection.Logout();
            tdConnection.Disconnect();
            tdConnection = null;

        }
        catch (Exception ex)
        {
            HPQC_Status_Test_Plan.Text = "Test Creation Failed.";
            Console.WriteLine("[Error] " + ex);

            tdConnection.Logout();
            tdConnection.Disconnect();
            tdConnection = null;

        }
    }

The code errors out on the Post with a simple “Failed to Post” and I’m at a loss as to why.

Here’s the API example in VB6:

Public Sub AddTest(FolderName$, TestName$)

Create new test.
This example assumes that the subject folder containing the
new test is directly under the root “Subject” folder.

Dim objTest As Test
Dim folder As SubjectNode
Dim testF As TestFactory
Dim TreeMgr As TreeManager
Dim Path As String

Dim Trees As List
Dim RootName As String
Dim SubjRoot As SubjectNode

'tdc is the global TDConnection object.
Set TreeMgr = tdc.TreeManager

' Use TreeManager.TreeRoot to get the list of subject
' root nodes from the tree manager.
' There is only one item in this list.
Set Trees = TreeMgr.RootList(TDOLE_SUBJECT)

' Get the name of the subject tree root in your project.
RootName = Trees.Item(1)

Path = RootName & "\" & FolderName

On Error Resume Next
Set folder = TreeMgr.NodeByPath(Path)
On Error GoTo 0

If folder Is Nothing Then 'Create the folder
    ' Get the SubjectNode root node object from the
    ' tree manager by name.
    Set SubjRoot = TreeMgr.TreeRoot(RootName)
    Set folder = SubjRoot.AddNode(FolderName)
End If

Set testF = folder.TestFactory
Set objTest = testF.AddItem(Null)
objTest.name = TestName
objTest.Type = "SYSTEM-TEST"
objTest.Post

Dim VerCtl As VCS
Dim bIsLocked As Boolean
Dim strLockedBy As String

Set VerCtl = objTest.VCS

VerCtl.Refresh

bIsLocked = VerCtl.IsLocked
strLockedBy = VerCtl.LockedBy

' After POST, Test is checked in.
Debug.Print "Is locked: " & bIsLocked
'Is locked: False
Debug.Print "Is locked by: """ & strLockedBy & """"
'Is locked by: ""

VerCtl.CheckOut -1, "To change state", True

VerCtl.Refresh

bIsLocked = VerCtl.IsLocked
strLockedBy = VerCtl.LockedBy

Debug.Print "Is locked: " & bIsLocked
'Is locked: True
Debug.Print "Is locked by: """ & strLockedBy & """"
'Is locked by: "User1"

' Take an arbitrary field to change.
Debug.Print "Status: """ & objTest.Field("TS_STATUS") & """"
'Status: ""

objTest.Field("TS_STATUS") = "Ready"

objTest.Post

VerCtl.CheckIn "", "Changed status"

VerCtl.Refresh

bIsLocked = VerCtl.IsLocked
strLockedBy = VerCtl.LockedBy

Debug.Print "Is locked: " & bIsLocked
'Is locked: False
Debug.Print "Is locked by: """ & strLockedBy & """"
'Is locked by: ""

End Sub

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:27:26+00:00Added an answer on June 9, 2026 at 3:27 pm

    Gave it the weekend to think it over, and realized that the code above didn’t have a parent attribute to link to in the tree. Unfortunately TreeManager in C# does not have TreeRoot to work with for some reason.

    Worked around that by grabbing the path manually for the prototype – the user has to key in parent path like “Root\Subject” into a textbox.

    The key attribute was the “TS_Subject” which is the NodeID of the folder that you want to attach the test to.

    The following code works for me:

    private void HPQC_Create_Test_Plan_Test(TDConnectionClass tdConnection, string ParentFolderPath, string TestName)
        {
            try
            {
                TreeManager treeM = (TreeManager)tdConnection.TreeManager;
                ISysTreeNode ParentFolder = (ISysTreeNode)treeM.get_NodeByPath(ParentFolderPath);
                TestFactory TestF = (TestFactory)tdConnection.TestFactory;
    
                Test TstTest = (Test)TestF.AddItem(System.DBNull.Value);
                TstTest.Name = TestName;
                TstTest.Type = "MANUAL";
                TstTest["TS_SUBJECT"] = ParentFolder.NodeID;
                TstTest.Post();
    
                HPQC_Status_Test_Plan.Text = "Test " + TestName + " created.";
    
                tdConnection.Logout();
                tdConnection.Disconnect();
                tdConnection = null;
    
            }
            catch (Exception ex)
            {
                HPQC_Status_Test_Plan.Text = "Test Creation Failed.";
                Console.WriteLine("[Error] " + ex);
    
                tdConnection.Logout();
                tdConnection.Disconnect();
                tdConnection = null;
    
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on some Plesk integration using the XML API and I am
I am writing a bash script to run an integration test of a tool
I'd like to add a continuous integration tool to a project I'm working on.
Has anyone had luck getting Qt Eclipse integration working on windows? Here is what
I'm working on Paypal integration in my website, following Paypal's API specifications. I'm testing
I am working on a integration test application, this is what I am doing
I am working with Integration of multiple applications which is using their own databases.
I am working on an integration script which will allow our company to view
I am working on twitter integration with android using Twiitter4j. I am trying to
I'm working on a recurring payment integration with Paypal and at this point the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.