/// <summary> /// Finds All Folders under a test plan folder. /// <para/>returns List of string with folder names /// </summary> /// <param name="testfolder">TDAPIOLELib.TestFolder Object</param> /// <returns>List of string with folder names</returns> public TDAPIOLELib.List GetChildFolders(TDAPIOLELib.TestFolder testFolder) { TDAPIOLELib.List List = new TDAPIOLELib.List(); foreach (TDAPIOLELib.TestFolder oFolder in testFolder.TestFolderFactory.NewList("")) { List.Add(oFolder); } return(List); }
/// <summary> /// Delete all attachments using attachmentfactory Object /// </summary> /// <param name="attachmentFactory">TDAPIOLELib.AttachmentFactory Object</param> /// <returns>True if successfull</returns> public static Boolean DeleteAllAttachments(TDAPIOLELib.AttachmentFactory attachmentFactory) { TDAPIOLELib.List AttachmentsList = attachmentFactory.NewList(""); foreach (TDAPIOLELib.Attachment OAttach in AttachmentsList) { attachmentFactory.RemoveItem(OAttach.ID); } return(true); }
/// <summary> /// Gets the TDAPIOLELib.ReleaseFolder object for each folder under Release Folder /// </summary> /// <param name="releaseFolder">TDAPIOLELib.ReleaseFolder Object</param> /// <returns>List of TDAPIOLELib.ReleaseFolder Objects</returns> public TDAPIOLELib.List GetChildFolders(TDAPIOLELib.ReleaseFolder releaseFolder) { TDAPIOLELib.List relFolderNames = new TDAPIOLELib.List(); foreach (TDAPIOLELib.ReleaseFolder rf in releaseFolder.ReleaseFolderFactory.NewList("")) { relFolderNames.Add(rf); } return(relFolderNames); }
/// <summary> /// Removes all tests from testset /// <para/>returns true if successfull /// </summary> /// <param name="testSet">TDAPIOLELib.TestSet Object</param> /// <returns>true if successfull</returns> public Boolean RemoveAllTests(TDAPIOLELib.TestSet testSet) { TDAPIOLELib.List list = testSet.TSTestFactory.NewList(""); foreach (TDAPIOLELib.TSTest tSTest in list) { testSet.TSTestFactory.RemoveItem(tSTest.ID); testSet.Post(); } return(true); }
/// <summary> /// Find test sets under TestLab Folder /// <para/>return TDAPIOLELib.List. Each item from the list can be converted to TDAPIOLELib.TestSet /// </summary> /// <param name="folderPath">TestLab folder path</param> /// <returns></returns> public TDAPIOLELib.List FindTestSets(String folderPath) { TDAPIOLELib.TestSetTreeManager testSetTreeManager = tDConnection.TestSetTreeManager; TDAPIOLELib.TestSetFolder testSetFolder = testSetTreeManager.NodeByPath[folderPath]; TDAPIOLELib.TestSetFactory testSetFactory = testSetFolder.TestSetFactory; TDAPIOLELib.List OTestSetList = testSetFactory.NewList(""); return(OTestSetList); }
/// <summary> /// Find child folders under a test plan folder /// <para>returns TDAPIOLELib.List Object containing the list of Test Set folder object</para> /// </summary> /// <param name="testSetFolder">TDAPIOLELib.TestSetFolder Object</param> /// <returns>TDAPIOLELib.List Object containing the list of Test Set folder object</returns> public TDAPIOLELib.List FindChildFolders(TDAPIOLELib.TestSetFolder testSetFolder) { TDAPIOLELib.List List = new TDAPIOLELib.List(); for (int Counter = 1; Counter <= testSetFolder.Count; Counter++) { List.Add(testSetFolder.Child[Counter]); } return(List); }
/// <summary> /// Returns a list of reports or graphs under analysis folder /// </summary> /// <param name="analysisItemFolder">Analysis folder object</param> /// <returns></returns> public TDAPIOLELib.List GetChildGraphs(TDAPIOLELib.AnalysisItemFolder analysisItemFolder) { TDAPIOLELib.List anaFolderNames = new TDAPIOLELib.List(); TDAPIOLELib.AnalysisItemFactory analysisItemFactory = analysisItemFolder.AnalysisItemFactory; foreach (TDAPIOLELib.AnalysisItemFolder aif in analysisItemFactory.NewList("")) { anaFolderNames.Add(aif); } return(anaFolderNames); }
/// <summary> /// Gets the list of releases under a release folder /// </summary> /// <param name="releaseFolder">TDAPIOLELib.ReleaseFolder Object</param> /// <returns>TDAPIOLELib.List Object</returns> public TDAPIOLELib.List GetReleases(TDAPIOLELib.ReleaseFolder releaseFolder) { TDAPIOLELib.List relNames = new TDAPIOLELib.List(); TDAPIOLELib.ReleaseFactory releaseFactory = releaseFolder.ReleaseFactory; foreach (TDAPIOLELib.Release ORel in releaseFactory.NewList("")) { relNames.Add(ORel); } return(relNames); }
public TDAPIOLELib.List FindChildFolders(TDAPIOLELib.DashboardFolder dashboardFolder) { TDAPIOLELib.DashboardFolderFactory dashboardFolderFactory = dashboardFolder.DashboardFolderFactory; TDAPIOLELib.List list = new TDAPIOLELib.List(); foreach (TDAPIOLELib.DashboardFolder DF in dashboardFolderFactory.NewList("")) { list.Add(DF); } return(list); }
/// <summary> /// Get the Child Folders for Analysis Folder /// </summary> /// <param name="folderPath">Path of the folder to search for the release</param> /// <returns>List of Analysis folder names</returns> public TDAPIOLELib.List GetChildFolders(String folderPath) { TDAPIOLELib.List anaFolderNames = new TDAPIOLELib.List(); TDAPIOLELib.AnalysisItemFolder analysisItemFolder = GetFolderObject(folderPath); TDAPIOLELib.AnalysisItemFolderFactory analysisItemFolderFactory = analysisItemFolder.AnalysisItemFolderFactory; foreach (TDAPIOLELib.AnalysisItemFolder aif in analysisItemFolderFactory.NewList("")) { anaFolderNames.Add(aif); } return(anaFolderNames); }
/// <summary> /// Finds the list of tests under unattached folder /// <para/>returns TDAPIOLELib.List Object. Each item from this list can be converted to TDAPIOLELib.Test Object /// </summary> /// <returns>TDAPIOLELib.List Object</returns> public TDAPIOLELib.List FindUnattachedTests() { TDAPIOLELib.List list = new TDAPIOLELib.List(); TDAPIOLELib.Recordset recordset = Utilities.ExecuteQuery("Select * from test where TS_SUBJECT = -2", tDConnection); recordset.First(); for (int Counter = 1; Counter <= recordset.RecordCount; Counter++) { list.Add(GetObjectWithID(Convert.ToInt32(recordset["TS_TEST_ID"]))); recordset.Next(); } return(list); }
/// <summary> /// Finds unattached testSets /// </summary> /// <returns>List of unattached testsets</returns> public TDAPIOLELib.List FindUnattachedTestSets() { TDAPIOLELib.List list = new TDAPIOLELib.List(); TDAPIOLELib.Recordset recordset = Utilities.ExecuteQuery("SELECT CY_CYCLE_ID FROM CYCLE Where CY_FOLDER_ID < 0 and CY_CYCLE_ID > 0", tDConnection); recordset.First(); for (int Counter = 1; Counter <= recordset.RecordCount; Counter++) { list.Add(GetObjectWithID(Convert.ToInt32(recordset["CY_CYCLE_ID"]))); recordset.Next(); } return(list); }
/// <summary> /// Gets the list of defects linked to ALM Entities /// </summary> /// <param name="Obj">Object Object</param> /// <returns>TDAPIOLELib.List Object</returns> private TDAPIOLELib.List GetLinkedDefectsToEntities(Object Obj) { TDAPIOLELib.ILinkable linkable = Obj as TDAPIOLELib.ILinkable; TDAPIOLELib.LinkFactory linkFactory = linkable.BugLinkFactory; TDAPIOLELib.List list = new TDAPIOLELib.List(); foreach (TDAPIOLELib.Link link in linkFactory.NewList("")) { list.Add(link.TargetEntity as TDAPIOLELib.Bug); } return(list); }
/// <summary> /// Delete Attachments by name /// </summary> /// <param name="attachmentFactory">TDAPIOLELib.AttachmentFactory Object</param> /// <param name="attachmentName">name of the attachment to be deleted</param> /// <returns>Return true if successfull</returns> public static Boolean DeleteAttachmentByName(TDAPIOLELib.AttachmentFactory attachmentFactory, String attachmentName) { TDAPIOLELib.List AttachmentsList = attachmentFactory.NewList(""); foreach (TDAPIOLELib.Attachment OAttach in AttachmentsList) { if (OAttach.Name.EndsWith(attachmentName)) { attachmentFactory.RemoveItem(OAttach.ID); break; } } return(true); }
public void Verify_TestSetFolders() { aLM_CORE.TestLab.TestLabFolders.Create("Root", "Dummy1"); aLM_CORE.TestLab.TestLabFolders.CreateNewFolderPath("Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4"); Console.WriteLine("Created TestLab Folders"); //Find Folders under a testlab folder List <String> list = aLM_CORE.TestLab.TestLabFolders.FindChildFolders("Root\\Dummy1"); foreach (String folderName in list) { Console.WriteLine("Folder Under Root\\Dummy\\ : " + folderName); } //Create two testsets Dictionary <String, String> testSet_New = new Dictionary <String, String>(); testSet_New.Add("CY_CYCLE", "Dummy test set name"); aLM_CORE.TestLab.TestSet.Create(testSet_New, "Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4"); testSet_New.Clear(); testSet_New.Add("CY_CYCLE", "Dummy test set name 2"); aLM_CORE.TestLab.TestSet.Create(testSet_New, "Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4"); TDAPIOLELib.List tdList = aLM_CORE.TestLab.TestLabFolders.FindTestSets("Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4"); foreach (TDAPIOLELib.TestSet testSet in tdList) { Console.WriteLine("TestSets under Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4 : " + testSet.Name); } TDAPIOLELib.SysTreeNode sysTreeNode = aLM_CORE.TestLab.TestLabFolders.GetNodeObject("Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4"); Console.WriteLine("sysTreeNode Object : " + sysTreeNode.Path); TDAPIOLELib.TestSetFolder testSetFolder = aLM_CORE.TestLab.TestLabFolders.GetTestSetFolder("Root\\Dummy1\\Dummy2\\Dummy3\\Dummy4"); Console.WriteLine("Parent Folder name : " + testSetFolder.Father.Name.ToString()); aLM_CORE.TestLab.TestLabFolders.Rename("Root\\Dummy1\\Dummy2\\Dummy3", "Dummy4", "Renamed Dummy4"); Console.WriteLine("Renamed a Folder"); aLM_CORE.TestLab.TestLabFolders.Delete("Root\\Dummy1\\Dummy2\\Dummy3", "Renamed Dummy4"); aLM_CORE.TestLab.TestLabFolders.Delete("Root\\Dummy1\\Dummy2", "Dummy3"); aLM_CORE.TestLab.TestLabFolders.Delete("Root\\Dummy1", "Dummy2"); aLM_CORE.TestLab.TestLabFolders.Delete("Root", "Dummy1"); Console.WriteLine("Deleted all folders"); Console.WriteLine("Done"); }
/// <summary> /// Delete all attachments from defect /// </summary> /// <param name="bug">TDAPIOLELib.Bug Object</param> /// <returns>True if Successfull</returns> public Boolean DeleteAllAttachments(TDAPIOLELib.Bug bug) { TDAPIOLELib.AttachmentFactory OAttachmentFactory; OAttachmentFactory = bug.Attachments; TDAPIOLELib.List AttachmentsList = OAttachmentFactory.NewList(""); foreach (TDAPIOLELib.Attachment OAttach in AttachmentsList) { OAttachmentFactory.RemoveItem(OAttach.ID); } return(true); }
/// <summary> /// Gets the release object by release name /// </summary> /// <param name="releaseFolder">TDAPIOLELib.ReleaseFolder Object</param> /// <param name="releaseName">Name of the release</param> /// <returns></returns> public TDAPIOLELib.Release GetReleaseByName(TDAPIOLELib.ReleaseFolder releaseFolder, String releaseName) { TDAPIOLELib.ReleaseFactory releaseFactory = releaseFolder.ReleaseFactory; TDAPIOLELib.TDFilter tDFilter = releaseFactory.Filter; tDFilter["REL_NAME"] = releaseName; TDAPIOLELib.List list = tDFilter.NewList(); if (list.Count == 1) { return(list[1] as TDAPIOLELib.Release); } return(null); }
/// <summary> /// Finds a Release Folder with name /// </summary> /// <param name="releaseFolder">TDAPIOLELib.ReleaseFolder Object</param> /// <param name="Name">Name of the folder to be serached</param> /// <returns>TDAPIOLELib.ReleaseFolder Object</returns> public TDAPIOLELib.ReleaseFolder GetChildFolderWithName(TDAPIOLELib.ReleaseFolder releaseFolder, String Name) { TDAPIOLELib.ReleaseFolderFactory releaseFolderFactory = releaseFolder.ReleaseFolderFactory; TDAPIOLELib.TDFilter tDFilter = releaseFolderFactory.Filter; tDFilter["RF_NAME"] = Name; TDAPIOLELib.List list = tDFilter.NewList(); if (list.Count > 0) { return(list[1]); } else { return(null); } }
public TDAPIOLELib.DashboardFolder FindPrivateFolder() { TDAPIOLELib.DashboardFolderFactory dashboardFolderFactory = tDConnection.DashboardFolderFactory; TDAPIOLELib.TDFilter tDFilter = dashboardFolderFactory.Filter; tDFilter["DF_NAME"] = "Private"; tDFilter["DF_OWNER"] = "__default__"; TDAPIOLELib.List list = dashboardFolderFactory.NewList(tDFilter.Text); foreach (TDAPIOLELib.DashboardFolder DF in list) { if (DF.Name.ToUpper() == "PRIVATE") { return(DF); } } return(null); }
/// <summary> /// Gets the folder object for the private folder /// </summary> /// <returns>TDAPIOLELib.AnalysisItemFolder Object</returns> public TDAPIOLELib.AnalysisItemFolder FindPrivateFolder() { TDAPIOLELib.AnalysisItemFolderFactory analysisItemFolderFactory = tDConnection.AnalysisItemFolderFactory; TDAPIOLELib.TDFilter tDFilter = analysisItemFolderFactory.Filter; tDFilter["AIF_NAME"] = "Private"; tDFilter["AIF_OWNER"] = "__default__"; TDAPIOLELib.List list = analysisItemFolderFactory.NewList(tDFilter.Text); foreach (TDAPIOLELib.AnalysisItemFolder OAF in list) { if (OAF.Name.ToUpper() == "PRIVATE") { return(OAF); } } return(null); }
/// <summary> /// Set target cycles for requirement /// </summary> /// <param name="req">TDAPIOLELib.Req Obejct</param> /// <param name="listofCycleIDs">List of Cycle ID's</param> /// <returns>True if successfull</returns> public Boolean SetTargetCycles(TDAPIOLELib.Req req, TDAPIOLELib.List listofCycleIDs) { req["RQ_TARGET_RCYC"] = listofCycleIDs; req.Post(); return(true); }
public void Verify_Requirements() { Dictionary <String, String> requirementDetails = new Dictionary <String, String>(); requirementDetails.Add("RQ_REQ_NAME", "Dummy1"); aLM_CORE.Requirements.Create(requirementDetails, "Requirements", TDAPIOLELib.TDAPI_PREDEFINED_REQ_TYPES.REQ_TYPE_FOLDER); TDAPIOLELib.Req req = aLM_CORE.Requirements.CreateFolder("Dummy2", "Requirements\\Dummy1"); aLM_CORE.Requirements.Delete(req); req = aLM_CORE.Requirements.GetReqByPath("Requirements\\Dummy1"); Console.WriteLine(req.Path); aLM_CORE.Requirements.UpdateFieldValue(req, "RQ_REQ_NAME", "Dummy6", true); Console.WriteLine("Requirement Name after change : " + req.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.Requirements.AddAttachements(req, Attach); aLM_CORE.Requirements.DeleteAttachementByName(req, "DOC2.docx"); aLM_CORE.Requirements.DeleteAllAttachments(req); aLM_CORE.TestPlan.TestFolders.Create("Subject", "Dummy1"); Dictionary <String, String> TestN = new Dictionary <String, String>(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST"); TestN.Add("TS_STATUS", "Ready"); aLM_CORE.TestPlan.TestFolders.Create("Subject\\Dummy1", "Dummy2"); TDAPIOLELib.Test test = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1"); TDAPIOLELib.Test test1 = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1\\Dummy2"); TestN.Clear(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST2"); TestN.Add("TS_STATUS", "Ready"); TDAPIOLELib.Test test2 = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1\\Dummy2"); //Create a requirement of type undefined TDAPIOLELib.Req req1 = aLM_CORE.Requirements.Create(requirementDetails, "Requirements\\Dummy6", TDAPIOLELib.TDAPI_PREDEFINED_REQ_TYPES.REQ_TYPE_UNDEFINED); aLM_CORE.Requirements.AddTestToRequirementsCoverage(test, req1); aLM_CORE.Requirements.AddTestPlanFolderToRequirementsCoverage(aLM_CORE.TestPlan.TestFolders.GetNodeObject("Subject\\Dummy1\\Dummy2").NodeID, req1); requirementDetails.Clear(); requirementDetails.Add("RQ_REQ_NAME", "Dummy2"); TDAPIOLELib.Req req2 = aLM_CORE.Requirements.Create(requirementDetails, "Requirements\\Dummy6", TDAPIOLELib.TDAPI_PREDEFINED_REQ_TYPES.REQ_TYPE_UNDEFINED); TDAPIOLELib.Trace trace1 = aLM_CORE.Requirements.AddRequirementTraceability_TraceFrom(req1, req2); TDAPIOLELib.Trace trace2 = aLM_CORE.Requirements.AddRequirementTraceability_TraceTo(req1, req2); foreach (TDAPIOLELib.Trace oTrace in aLM_CORE.Requirements.GetRequirementTraceability_TraceFrom(req1)) { Console.Write("Requirement Tracebility Trace from requirements : " + oTrace.FromReq.Name); } foreach (TDAPIOLELib.Trace oTrace in aLM_CORE.Requirements.GetRequirementTraceability_TraceTo(req1)) { Console.Write("Requirement Tracebility Trace from requirements : " + oTrace.ToReq.Name); } TDAPIOLELib.Recordset recordset = aLM_CORE.ExecuteQuery("Select REL_ID From Releases where rownum < 10"); recordset.First(); TDAPIOLELib.List releaseIDList = new TDAPIOLELib.List(); for (int Counter = 0; Counter < recordset.RecordCount; Counter++) { Console.WriteLine("Release ID : " + recordset[0]); releaseIDList.Add(recordset[0]); recordset.Next(); } aLM_CORE.Requirements.SetTargetReleases(req1, releaseIDList); foreach (TDAPIOLELib.Release release in aLM_CORE.Requirements.GetTargetReleases(req1)) { Console.WriteLine("Target Release ID : " + release.ID); } aLM_CORE.Requirements.DeleteTargetReleases(req1); recordset = aLM_CORE.ExecuteQuery("Select RCYC_ID From RELEASE_CYCLES where rownum < 10"); recordset.First(); TDAPIOLELib.List cycleIDList = new TDAPIOLELib.List(); for (int Counter = 0; Counter < recordset.RecordCount; Counter++) { Console.WriteLine("Cycle ID : " + recordset[0]); cycleIDList.Add(recordset[0]); recordset.Next(); } aLM_CORE.Requirements.SetTargetCycles(req1, cycleIDList); foreach (TDAPIOLELib.Cycle cycle in aLM_CORE.Requirements.GetTargetCycles(req1)) { Console.WriteLine("Target Cycle ID : " + cycle.ID); } aLM_CORE.Requirements.DeleteTargetCycles(req1); aLM_CORE.Requirements.DeleteRequirementTraceability_TraceFrom(req1, trace1); aLM_CORE.Requirements.DeleteRequirementTraceability_TraceTo(req1, trace2); foreach (TDAPIOLELib.Req oReq in aLM_CORE.Requirements.GetChildRequirements(aLM_CORE.Requirements.GetReqByPath("Requirements\\Dummy6"))) { Console.WriteLine("Child requirement Found : " + oReq.Name); } Console.WriteLine("Parent Requirement Name : " + aLM_CORE.Requirements.GetParentRequirement(aLM_CORE.Requirements.GetReqByPath("Requirements\\Dummy6\\Dummy1")).Name); aLM_CORE.Requirements.Delete(req1); aLM_CORE.Requirements.Delete(req2); aLM_CORE.Requirements.Delete(req); aLM_CORE.TestPlan.Test.Delete(test); aLM_CORE.TestPlan.Test.Delete(test1); aLM_CORE.TestPlan.Test.Delete(test2); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1"); }
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> /// Set target releases for a requirements. /// </summary> /// <param name="req">TDAPIOLELib.Req Object</param> /// <param name="listofReleaseIDs">TDAPIOLELib.List of Release ID's</param> /// <returns>True if successfull</returns> public Boolean SetTargetReleases(TDAPIOLELib.Req req, TDAPIOLELib.List listofReleaseIDs) { req["RQ_TARGET_REL"] = listofReleaseIDs; req.Post(); return(true); }
/// <summary> /// Find target releases for requirement /// </summary> /// <param name="req">TDAPIOLELib.Req Object</param> /// <returns>List of Target releases</returns> public TDAPIOLELib.List GetTargetReleases(TDAPIOLELib.Req req) { TDAPIOLELib.List listofReleaseIDs = req["RQ_TARGET_REL"]; return(listofReleaseIDs); }
public void Verify_TestScripts() { //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); //Add Design steps //Expected Values List <String> Expected = new List <String>(); Expected.Add("Step dummy 1"); Expected.Add("Step dummy 2"); //Description values List <String> Desc = new List <String>(); Desc.Add("Step dummy 1 Desc"); Desc.Add("Step dummy 2 Desc"); //Attachments for the design steps List <String> Attach = new List <String>(); Attach.Add(@"C:\Temp\ALMUPLOAD\DOC2.docx"); Attach.Add(@"C:\Temp\ALMUPLOAD\DOC3.xlsx"); aLM_CORE.TestPlan.Test.AddDesignSteps(test, Desc, Expected, Attach); Console.WriteLine("Added Bulk design steps with attachments to test"); //clear Attach Attach.Clear(); //Upload two attachments to design step Attach.Add(@"C:\Temp\ALMUPLOAD\DOC1.txt"); Attach.Add(@"C:\Temp\ALMUPLOAD\DOC3.xlsx"); TDAPIOLELib.DesignStep designStep = aLM_CORE.TestPlan.Test.AddSingleDeignStep(test, "Single Step", "Nothing is expected"); aLM_CORE.TestPlan.Test.AddAttachmentToDesignStep(designStep, Attach); Console.WriteLine("Added Single design step with two attachments to test"); aLM_CORE.TestPlan.Test.AddSingleParameter(test, "BrowserName", "Chrome, IE, Firefox", "Chrome"); Console.WriteLine("Added Single parameter"); //Add test parameters List <String> ParamName = new List <String>(); ParamName.Add("Browser"); ParamName.Add("URL"); List <String> ParamDescription = new List <String>(); ParamDescription.Add("Browser for executions"); ParamDescription.Add("URL to be used"); List <String> ParamDefaultVal = new List <String>(); ParamDefaultVal.Add("IE"); ParamDefaultVal.Add("Http://www.google.com"); aLM_CORE.TestPlan.Test.AddParameters(test, ParamName, ParamDescription, ParamDefaultVal); Console.WriteLine("Added Bulk Parameters to test"); Console.WriteLine("Number of tests in test plan : " + aLM_CORE.TestPlan.Test.CountAllTests().ToString()); Console.WriteLine("Number of tests under Subject\\Dummy1 : " + aLM_CORE.TestPlan.Test.CountTestUnderFolder("Subject\\Dummy1")); //Search test with ID test = aLM_CORE.TestPlan.Test.GetObjectWithID(Convert.ToInt32(test.ID)); TDAPIOLELib.List tdList = aLM_CORE.TestPlan.Test.GetDesignStepList(test); Console.WriteLine("Printing design steps for test.."); foreach (TDAPIOLELib.DesignStep ODes in tdList) { Console.WriteLine(ODes.StepDescription + " : " + ODes.StepExpectedResult); } //Add Attachments to test List <String> AttachmentsPath = new List <string>(); AttachmentsPath.Add(@"C:\Temp\ALMUPLOAD\DOC1.txt"); AttachmentsPath.Add(@"C:\Temp\ALMUPLOAD\DOC3.xlsx"); AttachmentsPath.Add(@"C:\Temp\ALMUPLOAD\DOC2.docx"); aLM_CORE.TestPlan.Test.AddAttachment(test, AttachmentsPath); Console.WriteLine("Added Attachments to test"); aLM_CORE.TestPlan.Test.DownloadAttachments(test, "C:\\Temp\\ALMDOWNLOAD"); Console.WriteLine("Downloaded test attachments to C:\\Temp\\ALMDOWNLOAD"); aLM_CORE.TestPlan.Test.DeleteAttachmentByName(test, "DOC3.xlsx"); Console.WriteLine("Deleted Attachment by name"); aLM_CORE.TestPlan.Test.DeleteAllAttachments(test); Console.WriteLine("Deleted all attachment"); Console.WriteLine("Path of test case : " + aLM_CORE.TestPlan.Test.GetPath(test)); aLM_CORE.TestPlan.Test.MarkAsTemplate(test); Console.WriteLine("Marked test as template test"); aLM_CORE.TestPlan.Test.UpdateFieldValue(test, "TS_STATUS", "Design"); Console.WriteLine("Updated Test Field value"); aLM_CORE.TestPlan.Test.Delete(test); Console.WriteLine("Deleted test"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1"); Console.WriteLine("Deleted Folder Dummy1"); Console.WriteLine("Reading tests from unattached..."); TDAPIOLELib.List Tdlist = aLM_CORE.TestPlan.Test.FindUnattachedTests(); foreach (TDAPIOLELib.Test Otest in Tdlist) { Console.WriteLine("Tests from unattached : " + Otest.Name);// + ", Path : " + aLM_CORE.TestPlan.Test.GetPath(test)); } //Delete All Unattached tests foreach (TDAPIOLELib.Test Otest in Tdlist) { aLM_CORE.TestPlan.Test.Delete(Otest); } Console.WriteLine("Deleted all tests from Unattached"); Console.WriteLine("Done"); }
public void Verify_TestFolder() { /////Test TestFolders.Cs TDAPIOLELib.TestFolder parent = aLM_CORE.TestPlan.TestFolders.Create("Subject", "Dummy1"); aLM_CORE.TestPlan.TestFolders.CreateNewFolderPath("Subject\\Dummy1\\Dummy2\\Dummy3"); aLM_CORE.TestPlan.TestFolders.CreateNewFolderPath("Subject\\Dummy1\\Dummy4\\Dummy5"); aLM_CORE.TestPlan.TestFolders.CreateNewFolderPath("Subject\\Dummy1\\Dummy6\\Dummy7"); Console.WriteLine("Folders Created Successfully in ALM"); List <String> list = aLM_CORE.TestPlan.TestFolders.GetChildFolderNames("Subject\\Dummy1"); foreach (String folderName in list) { Console.WriteLine("Folder Found under Subject\\Dummy1 : " + folderName); } list = aLM_CORE.TestPlan.TestFolders.GetChildFolderNames(parent); foreach (String folderName in list) { Console.WriteLine("Folder Found under Subject\\Dummy1 : " + folderName); } TDAPIOLELib.SysTreeNode sysTreeNode = aLM_CORE.TestPlan.TestFolders.GetNodeObject("Subject\\Dummy1\\Dummy6"); Console.WriteLine("Count of folders under this folder is : " + sysTreeNode.Count); parent = aLM_CORE.TestPlan.TestFolders.GetFolderObject("Subject\\Dummy1\\Dummy6"); Console.WriteLine("Count of folders under this folder is : " + parent.TestFolderFactory.NewList("").Count); //Create first test under folder Dictionary <String, String> TestN = new Dictionary <String, String>(); TestN.Add("TS_NAME", "THIS IS DUMMUY TEST"); TestN.Add("TS_STATUS", "Ready"); aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1\\Dummy6"); TestN.Clear(); //Create second test inder folder TestN.Add("TS_NAME", "THIS IS DUMMUY TEST1"); TestN.Add("TS_STATUS", "Design"); aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1\\Dummy6"); //Get the List of folders under test folder TDAPIOLELib.List Tdlist = aLM_CORE.TestPlan.TestFolders.GetTests("Subject\\Dummy1\\Dummy6"); foreach (TDAPIOLELib.Test test in Tdlist) { Console.WriteLine("Test Found under Subject\\Dummy1\\Dummy6 : " + test.Name); } //Create test under Dummy 7, which is under dummy 6 TestN.Clear(); //Create second test inder folder TestN.Add("TS_NAME", "THIS IS DUMMUY TEST2"); TestN.Add("TS_STATUS", "Design"); TDAPIOLELib.Test test12 = aLM_CORE.TestPlan.Test.Create(TestN, "Subject\\Dummy1\\Dummy6\\Dummy7"); Tdlist = aLM_CORE.TestPlan.TestFolders.GetTestsRecurcively("Subject\\Dummy1\\Dummy6"); foreach (TDAPIOLELib.Test test in Tdlist) { Console.WriteLine("Test Found Name : " + test.Name + ", Path : " + aLM_CORE.TestPlan.Test.GetPath(test)); } //Rename aLM_CORE.TestPlan.TestFolders.Rename("Subject\\Dummy1\\Dummy6\\Dummy7", "Renamed7"); //Now read the tests again Tdlist = aLM_CORE.TestPlan.TestFolders.GetTestsRecurcively("Subject\\Dummy1\\Dummy6"); foreach (TDAPIOLELib.Test test in Tdlist) { Console.WriteLine("After Renaming Folder Test Found Name : " + test.Name + ", Path : " + aLM_CORE.TestPlan.Test.GetPath(test)); } aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1\\Dummy2\\Dummy3"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1\\Dummy4\\Dummy5"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1\\Dummy6\\Renamed7", true); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1\\Dummy2"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1\\Dummy4"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1\\Dummy6"); aLM_CORE.TestPlan.TestFolders.Delete("Subject\\Dummy1"); aLM_CORE.TestPlan.Test.Delete(test12); Console.WriteLine("Deleted all folders"); Console.WriteLine("Done"); }
/// <summary> /// Get target cycles /// </summary> /// <param name="req">TDAPIOLELib.Req Object</param> /// <returns>True if successfull</returns> public TDAPIOLELib.List GetTargetCycles(TDAPIOLELib.Req req) { TDAPIOLELib.List listofCycleIDs = req["RQ_TARGET_RCYC"]; return(listofCycleIDs); }