Example Title |
Copy Code
|
---|---|
/* * How to call: //1 for test //TestSetFactory tempTestSetF = (TestSetFactory) tdConnection.TestSetFactory; //TestSet tempTestSet = (TestSet) tempTestSetF[2]; //GetTestSet((TestSetFolder)tempTestSet.TestSetFolder, "DemoTest1fortestset", "Open"); //2 for test TestSetTreeManager testSetFolderF = (TestSetTreeManager)tdConnection.TestSetTreeManager; TestSetFolder tstSetFolder = (TestSetFolder)testSetFolderF.NodeByPath["Root"]; TestSetFolder tstSetFolderSub = (TestSetFolder)tstSetFolder.FindChildNode("Test Sets Demo"); GetTestSet(tstSetFolderSub, "DemoTest1fortestset1", "Open"); */ public TestSet GetTestSet(TestSetFolder testSetF, String tsName, String tsStatus) { try { TestSetTreeManager testSetFolderF; TestSet testSet1; List tsList; bool found; tsList = null; testSet1 = null; found = false; try { tsList = testSetF.FindTestSets(tsName); if (tsList != null) { if (tsList.Count > 0) { foreach (TestSet ts in tsList) { if (ts.Name.ToString() == tsName) { testSet1 = ts; found = true; break; } } } } } finally { if (!found) { TestSetFactory tsFact; tsFact = testSetF.TestSetFactory; testSet1 = tsFact.AddItem(DBNull.Value); testSet1.Name = tsName; testSet1.Status = tsStatus; testSet1.Post(); } } return testSet1; } catch (Exception) { return null; } } |