Creating Test Plan Folders using OTA API

In this post, we will discuss creating folders in ALM Test plan using OTA API. We will use C#.

To create a folder in test plan using OTA API we will use the following Classes from OTA API.

  1. TreeManager – To get the SysTreeNode Object.
  2. SysTreeNode – To add the new test folder in the TestPlan.

First, we will get the SysTreeNode Object of the current folder path from the test plan. So, if you want to create a folder under Subject folder then we will need to get the SysTreeNode object of the Subject Folder.

TDAPIOLELib.TreeManager OTManager = tDConnection.TreeManager;
TDAPIOLELib.SysTreeNode OSysTreeNode = OTManager.NodeByPath[folderPath];

Where Folder Path will be “Subject”, if you want to create a Folder under Subject Folder.

Once we have the SysTreeNode Object then we will just have to add the new folder


Complete Code

public Boolean Create(String parentFolderPath, String newFolderName)
TDAPIOLELib.SysTreeNode OSysTreeNode = GetNodeObject(parentFolderPath);
return true;

public TDAPIOLELib.SysTreeNode GetNodeObject(String folderPath)
TDAPIOLELib.TreeManager OTManager = tDConnection.TreeManager;
return OTManager.NodeByPath[folderPath];

To create a new Folder under Subject Folder, You can call the create Function like this

Create("Subject", "Dummy1");

To create a new folder under this Dummy1 folder

Create("Subject\\Dummy1", "Dummy2");

Let me know if you have any questions in Comments.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s