mercredi 24 mars 2021

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?

I have tried the below code to create a folder structure in Test Plan using OTA, but unable to do so.. I am getting message saying Node not found.. Please help me out with the proper code

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");
}

Aucun commentaire:

Enregistrer un commentaire