/// <summary> /// Removes a single test from test set /// <para/>returns true if successfull /// </summary> /// <param name="testSet">TDAPIOLELib.TestSet Object</param> /// <param name="tSTest">TDAPIOLELib.TSTest Object</param> /// <returns></returns> public Boolean RemoveTest(TDAPIOLELib.TestSet testSet, TDAPIOLELib.TSTest tSTest) { TDAPIOLELib.TSTestFactory tSTestFactory = testSet.TSTestFactory; tSTestFactory.RemoveItem(tSTest.ID); testSet.Post(); return(true); }
public TDAPIOLELib.TSTest AddTest(TDAPIOLELib.TestSet testSet, TDAPIOLELib.Test test) { TDAPIOLELib.TSTestFactory tSTestFactory = testSet.TSTestFactory; TDAPIOLELib.TSTest tSTest = tSTestFactory.AddItem(test.ID); tSTest.Post(); return(tSTest); }
public void verify_TestSets() { aLM_CORE.TestLab.TestLabFolders.Create("Root", "Dummy1"); Dictionary <String, String> testSetDetails = new Dictionary <string, string>(); testSetDetails.Add("CY_CYCLE", "Dummy Test Set"); TDAPIOLELib.TestSet testSet = aLM_CORE.TestLab.TestSet.Create(testSetDetails, "Root\\Dummy1"); Console.WriteLine("Test Set created : " + testSet.Name); //Create a test folder and a test inside it. We will add this to the testSet we created above aLM_CORE.TestPlan.TestFolders.Create("Subject", "Dummy1"); Console.WriteLine("Test Folder Created : Subject\\Dummy1"); //create a test here Dictionary <String, String> TestN = new Dictionary <String, String>(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST"); TestN.Add("TS_STATUS", "Ready"); TDAPIOLELib.Test test = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1"); Console.WriteLine("Test Created : " + test.Name); //Addign test to testset aLM_CORE.TestLab.TestSet.AddTest(testSet, test); Console.WriteLine("Test added to test set"); //Create a new folder in test plan and add three new tests to it //Create a test folder and a test inside it. We will add this to the testSet we created above aLM_CORE.TestPlan.TestFolders.Create("Subject", "Dummy2"); Console.WriteLine("Test Folder Created : Subject\\Dummy2"); TestN.Clear(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST 1"); TestN.Add("TS_STATUS", "Ready"); TDAPIOLELib.Test test1 = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy2"); TestN.Clear(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST 2"); TestN.Add("TS_STATUS", "Ready"); TDAPIOLELib.Test test2 = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy2"); TestN.Clear(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST 3"); TestN.Add("TS_STATUS", "Ready"); TDAPIOLELib.Test test3 = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy2"); Console.WriteLine("Created three new tests and added it to the folder Subject\\Dummy2"); aLM_CORE.TestLab.TestSet.AddAllTestsFromTestFolder(testSet, "Subject\\Dummy2"); Console.WriteLine("Three tests from Subject\\Dummy2 are added to testSet : " + testSet.Name); List <String> Attach = new List <String>(); Attach.Add("C:\\Temp\\ALMUPLOAD\\DOC1.txt"); Attach.Add("C:\\Temp\\ALMUPLOAD\\DOC2.docx"); Attach.Add("C:\\Temp\\ALMUPLOAD\\DOC3.xlsx"); aLM_CORE.TestLab.TestSet.AddAttachments(testSet, Attach); Console.WriteLine("Added Attachments to testset"); aLM_CORE.TestLab.TestSet.PassAllTests(testSet); Console.WriteLine("Executed all tests from test set and updated status as passed"); aLM_CORE.TestLab.TestSet.FailAllTests(testSet); Console.WriteLine("Executed all tests from test set and updated status as Failed"); TDAPIOLELib.List TSTestList = aLM_CORE.TestLab.TestSet.GetAllTestInstance(testSet); aLM_CORE.TestLab.TestSet.ExecuteSingleTest(TSTestList[1], "Not Completed"); Console.WriteLine("Executed First test from test set and marked it as Not Completed"); Dictionary <int, String> executionList = new Dictionary <int, String>(); //Mark all tests as No Run //Create the dictionary object for the test set foreach (TDAPIOLELib.TSTest tSTest1 in TSTestList) { executionList.Add(Convert.ToInt32(tSTest1.ID), "No Run"); } aLM_CORE.TestLab.TestSet.ExecuteTests(executionList); Console.WriteLine("Changed status of all tests to No Run"); testSet = aLM_CORE.TestLab.TestSet.GetObjectWithID(Convert.ToInt32(testSet.ID)); Console.WriteLine("Got test set with ID"); Console.WriteLine("TestLab Folder Path for the test set is : " + aLM_CORE.TestLab.TestSet.GetFolderPath(testSet)); //Console.WriteLine("Test Plan Folder path for the First test in the test set is : " + aLM_CORE.TestPlan.Test.GetPath((aLM_CORE.TestLab.TestSet.GetTestObjectFromTestSetTest((TSTestList[0] as TDAPIOLELib.TSTest).ID) as TDAPIOLELib.Test))); TDAPIOLELib.TSTest tSTest = aLM_CORE.TestLab.TestSet.GetTSTestWithID(Convert.ToInt32(TSTestList[2].ID)); Console.WriteLine("Found Second Test Object from test set : " + tSTest.TestName); TDAPIOLELib.Run run = aLM_CORE.TestLab.TestSet.GetLastRunDetails(TSTestList[1]); Console.WriteLine("Got last run details for test set test : " + run.Name + " : " + run.ID); aLM_CORE.TestLab.TestSet.RemoveTest(testSet, TSTestList[1]); Console.WriteLine("Removed first test from testset"); aLM_CORE.TestLab.TestSet.RemoveAllTests(testSet); Console.WriteLine("Removed all tests from testset"); aLM_CORE.TestLab.TestSet.DownloadAttachements(testSet, "C:\\Temp\\ALMDOWNLOAD"); Console.WriteLine("Downloaded attachements"); aLM_CORE.TestLab.TestSet.DeleteAttachmentByName(testSet, "DOC1.txt"); Console.WriteLine("Deleted attachment by name : DOC1.txt"); aLM_CORE.TestLab.TestSet.DeleteAllAttachments(testSet); Console.WriteLine("Deleted all attachments"); Console.WriteLine("Printing testsets under unattached..."); TDAPIOLELib.List unattachedTestSetsList = aLM_CORE.TestLab.TestSet.FindUnattachedTestSets(); foreach (TDAPIOLELib.TestSet unattachedTestSets in unattachedTestSetsList) { Console.WriteLine(unattachedTestSets.Name); } Console.WriteLine("Done"); aLM_CORE.TestLab.TestSet.UpdateFieldValue(testSet, "CY_STATUS", "Closed"); //CleanUp aLM_CORE.TestLab.TestSet.Delete(testSet); aLM_CORE.TestLab.TestLabFolders.Delete("Root", "Dummy1"); aLM_CORE.TestPlan.Test.Delete(test); aLM_CORE.TestPlan.Test.Delete(test1); aLM_CORE.TestPlan.Test.Delete(test2); aLM_CORE.TestPlan.Test.Delete(test3); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy2"); }
public void Verify_Defects() { Dictionary <String, String> defectDetails = new Dictionary <string, string>(); defectDetails.Add("BG_SUMMARY", "Defect created using Automation"); defectDetails.Add("BG_USER_TEMPLATE_01", "TEST"); defectDetails.Add("BG_DETECTED_IN_RCYC", "1014"); defectDetails.Add("BG_DETECTION_DATE", DateTime.Now.ToShortDateString()); defectDetails.Add("BG_SEVERITY", "Sev-3"); defectDetails.Add("BG_DETECTED_BY", "Sumeet.Kushwah"); TDAPIOLELib.Bug bug = aLM_CORE.Defect.Create(defectDetails); Console.WriteLine("Total Defects in Project : " + aLM_CORE.Defect.CountAll()); TDAPIOLELib.Recordset ORec = aLM_CORE.Defect.GetAllDetails(bug); Console.WriteLine("Writing all Database field names and values..."); for (int i = 0; i < ORec.RecordCount; i++) { for (int j = 0; j < ORec.ColCount; j++) { Console.WriteLine(ORec.ColName[j] + "--" + ORec[j]); } ORec.Next(); } //Create a test and Link defect to it // Create a test folder aLM_CORE.TestPlan.TestFolders.Create("Subject", "Dummy1"); //create a test here Dictionary <String, String> TestN = new Dictionary <String, String>(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST"); TestN.Add("TS_STATUS", "Ready"); TDAPIOLELib.Test test = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1"); Console.WriteLine("Test Created Under Folder Subject\\Dummy1" + test.Name); aLM_CORE.Defect.LinkDefectToTest(test, bug, "Linking defect to test"); //Create a test set and Link defects to it aLM_CORE.TestLab.TestLabFolders.Create("Root", "Dummy1"); Dictionary <String, String> testSetDetails = new Dictionary <string, string>(); testSetDetails.Add("CY_CYCLE", "Dummy Test Set"); TDAPIOLELib.TestSet testSet = aLM_CORE.TestLab.TestSet.Create(testSetDetails, "Root\\Dummy1"); aLM_CORE.Defect.LinkDefectToTestSet(testSet, bug, "Test Set to Bug Linked"); TDAPIOLELib.TSTest tSTest = aLM_CORE.TestLab.TestSet.AddTest(testSet, test); aLM_CORE.Defect.LinkDefectToTestSetTest(tSTest, bug, "Test Set Test to Bug Linked"); TDAPIOLELib.List list = aLM_CORE.Defect.GetLinkedDefectsToTest(test); foreach (TDAPIOLELib.Bug bug1 in list) { Console.WriteLine("Defect Attached to test is : " + bug1.Summary); } list = aLM_CORE.Defect.GetLinkedDefectsToTestSet(testSet); foreach (TDAPIOLELib.Bug bug1 in list) { Console.WriteLine("Defect Attached to testset is : " + bug1.Summary); } list = aLM_CORE.Defect.GetLinkedDefectsToTestSetTest(tSTest); foreach (TDAPIOLELib.Bug bug1 in list) { Console.WriteLine("Defect Attached to testset test is : " + bug1.Summary); } List <String> Attach = new List <String>(); Attach.Add("C:\\Temp\\ALMUPLOAD\\DOC1.txt"); Attach.Add("C:\\Temp\\ALMUPLOAD\\DOC2.docx"); Attach.Add("C:\\Temp\\ALMUPLOAD\\DOC3.xlsx"); aLM_CORE.Defect.AddAttachment(bug, Attach); aLM_CORE.Defect.DownloadAttachments(bug, "C:\\Temp\\ALMDOWNLOAD"); aLM_CORE.Defect.DeleteAttachmentByName(bug, "DOC2.docx"); aLM_CORE.Defect.DeleteAllAttachments(bug); try { aLM_CORE.Defect.UpdateFieldValue(bug, "BG_STATUS", "Closed"); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } bug = aLM_CORE.Defect.GetObjectWithID(Convert.ToInt32(bug.ID)); aLM_CORE.TestPlan.Test.Delete(test); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1"); aLM_CORE.TestLab.TestLabFolders.Delete("Root", "Dummy1"); aLM_CORE.TestLab.TestSet.Delete(testSet); aLM_CORE.Defect.Delete(bug); Console.WriteLine("Done"); }
/// <summary> /// Gets the list of defects linked to testset test /// </summary> /// <param name="tSTest">TDAPIOLELib.TSTest Object</param> /// <returns>TDAPIOLELib.List Object</returns> public TDAPIOLELib.List GetLinkedDefectsToTestSetTest(TDAPIOLELib.TSTest tSTest) { return(GetLinkedDefectsToEntities(tSTest)); }
/// <summary> /// Link Defect to TestSet Test /// </summary> /// <param name="tSTest">TDAPIOLELib.TSTest Object</param> /// <param name="bug">TDAPIOLELib.Bug Object</param> /// <param name="comment">Comment</param> /// <returns>True if Successfull</returns> public Boolean LinkDefectToTestSetTest(TDAPIOLELib.TSTest tSTest, TDAPIOLELib.Bug bug, String comment = "") { return(LinkDefectToEntities(tSTest, bug, comment)); }
/// <summary> /// Get Test Plan Test Object from Test Set Test Object /// <para/>returns TDAPIOLELib.Test object /// </summary> /// <param name="tSTest"></param> /// <returns></returns> public TDAPIOLELib.Test GetTestObjectFromTestSetTest(TDAPIOLELib.TSTest tSTest) { return(tSTest.Test); }
/// <summary> /// Execute a single TSTest /// <para/>returns true if successfull /// </summary> /// <param name="tSTest">TDAPIOLELib.TSTest Object</param> /// <param name="Status">Execution Status</param> /// <returns>true if successfull</returns> public Boolean ExecuteSingleTest(TDAPIOLELib.TSTest tSTest, String Status) { return(RunTestSetTest(tSTest.RunFactory, Status)); }
/// <summary> /// Get last run object for TSTest object /// <para/>TDAPIOLELib.Run object /// </summary> /// <param name="tSTest">TSTest Object</param> /// <returns>TDAPIOLELib.Run object</returns> public TDAPIOLELib.Run GetLastRunDetails(TDAPIOLELib.TSTest tSTest) { return(tSTest.LastRun); }