如何创建 C# OTA 代码以根据 ALM 测试计划中 Excel 中提供的路径创建文件夹。你能帮我解决这个问题吗?

How to create a C# OTA code to create a folders based on the path provided in Excel in Test plan in ALM. Could you please help me on this?

我已尝试使用以下代码使用 OTA 在测试计划中创建文件夹结构,但无法这样做。我收到消息说找不到节点。请用正确的代码帮助我

Folderpath =  Subject\UAT\UAT2\Testcases

private void Upload_Test_Click(object sender, EventArgs e)
{
if (File_path.Text == null)
{
MetroMessageBox.Show(this, "Please Select a Valid File", "File", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
string path = File_path.Text;
FileInfo fileinfo = new FileInfo(path);
ExcelPackage excel = new ExcelPackage(fileinfo);
var worksheet = excel.Workbook.Worksheets["Test Cases"];
//get te number of rows and columns in the sheet
int rows = worksheet.Dimension.Rows;
int columns = worksheet.Dimension.Columns;
int i = 2;
//loop through the worksheet rows and columsn
while (i <= rows)
{
testfact = (ITestFactory2)LoginForm.qctd.TestFactory;
TreeManager treemgr = LoginForm.qctd.TreeManager;
SysTreeNode tstrr = treemgr.NodeByPath[worksheet.Cells[i, 1].Value.ToString()];
tstrr.AddNode(worksheet.Cells[i, 2].Value.ToString());
tstrr.Post();
tstrr.Refresh();
List testlist = tstrr.NewList();
foreach(Test tset in testlist)
{
tset["TS_NAME"] = worksheet.Cells[i, 2].Value.ToString();
tset.Post();
tset.Refresh();
}
i = i + 1;
}
MessageBox.Show("Test Uplaoded successfully");
}

如果您添加有关错误的更多详细信息(例如发生错误的行),将会很有帮助。我假设您在调用 treemgr.NodeByPath 时得到了它,这意味着没有具有此类路径的文件夹 - 检查您的 ALM 文件夹或调整您的脚本以创建丢失的文件夹