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); }
/// <summary> /// Update the field values for the test. /// <para/> returns true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="fieldName">database field name</param> /// <param name="newValue">new value for the field</param> /// <returns></returns> public Boolean UpdateFieldValue(TDAPIOLELib.Test test, String fieldName, String newValue, Boolean Post = true) { test[fieldName.ToUpper()] = newValue; if (Post) { test.Post(); } return(true); }
/// <summary> /// Add design steps to test. description[0], expectedResults[0] will become first step and attachmentsPath[0] will be attached to it. /// <para/> returns true if design steps are added /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="description">List of all descriptions to be added to test. For each description in the list one design step will be added to the test case</param> /// <param name="expectedResults">List of all expected results to be added to the test.</param> /// <param name="attachmentsPath">List of all attachemnts to be added. </param> /// <returns>true if design steps are added</returns> public Boolean AddDesignSteps(TDAPIOLELib.Test test, List <String> description, List <String> expectedResults, List <String> attachmentsPath) { for (int Counter = 0; Counter < description.Count; Counter++) { AddSingleDeignStep(test, description[Counter], expectedResults[Counter], attachmentsPath[Counter]); } return(true); }
/// <summary> /// Add Test Configurations for a test plan test /// <para/> returns TDAPIOLELib.TestConfig Object if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="testConfigName">Name for the new test config</param> /// <param name="testConfigDesc">Description for the new test config</param> /// <returns>return TDAPIOLELib.TestConfig Object if successfull</returns> public TDAPIOLELib.TestConfig AddTestConfiguration(TDAPIOLELib.Test test, String testConfigName, String testConfigDesc = "") { TDAPIOLELib.ITestConfigFactory testConfigFactory = test.TestConfigFactory; TDAPIOLELib.TestConfig testConfig = testConfigFactory.AddItem(System.DBNull.Value); testConfig["TSC_NAME"] = testConfigName; testConfig["TSC_DESC"] = testConfigDesc; testConfig.Post(); return(testConfig); }
/// <summary> /// Get the test plan folder path of a test case. /// <para/> returns test plan path of the test case /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <returns>test plan path of the test case</returns> public String GetPath(TDAPIOLELib.Test test) { try { return(test["TS_SUBJECT"].Path); } catch (Exception ex) { throw ex; } }
/// <summary> /// Delete a test from test plan. /// <para/> returns true if test is deleted from test plan /// </summary> /// <param name="test">TDAPIOLELib.Test object</param> /// <returns>true if test is deleted from test plan</returns> public Boolean Delete(TDAPIOLELib.Test test) { try { TDAPIOLELib.TestFactory OTFactory = tDConnection.TestFactory; OTFactory.RemoveItem(test.ID); return(true); } catch (Exception ex) { throw ex; } }
/// <summary> /// Download design step attachments /// <para/> return true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="attachmentDownloadPath">Path</param> /// <returns>true if successfull</returns> public Boolean DownloadDesignStepsAttachments(TDAPIOLELib.Test test, String attachmentDownloadPath) { TDAPIOLELib.TestFactory testFactory = tDConnection.TestFactory as TDAPIOLELib.TestFactory; foreach (TDAPIOLELib.DesignStep ODesignStep in GetDesignStepList(test)) { if (ODesignStep.HasAttachment) { Utilities.DownloadAttachments(ODesignStep.Attachments, attachmentDownloadPath); } } return(true); }
/// <summary> /// Adds a single parameter to test. /// <para/> returns true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="paramName">parameter name</param> /// <param name="paramDescription">parameter descriptio</param> /// <param name="ParamDefaultValue">paramater default value</param> /// <returns>true if successfull</returns> public Boolean AddSingleParameter(TDAPIOLELib.Test test, String paramName, String paramDescription, String paramDefaultValue = "") { TDAPIOLELib.TestParameterFactory OTestParamFactory; TDAPIOLELib.ISupportTestParameters OISupportTestParams; TDAPIOLELib.TestParameter OTestParameter; OISupportTestParams = test as TDAPIOLELib.ISupportTestParameters; OTestParamFactory = OISupportTestParams.TestParameterFactory as TDAPIOLELib.TestParameterFactory; OTestParameter = OTestParamFactory.AddItem(System.DBNull.Value); OTestParameter.Name = paramName; OTestParameter.Description = paramDescription; OTestParameter.DefaultValue = paramDefaultValue; OTestParameter.Post(); return(true); }
/// <summary> /// Adds parameters to the test. /// <para/> returns true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="paramName">List of parameter names to be added to tests</param> /// <param name="paramDescription">List of parameter descriptions for the parameter names</param> /// <param name="paramDefaultValue">List of default values for the parameter names</param> /// <returns>true if successfull</returns> public Boolean AddParameters(TDAPIOLELib.Test test, List <String> paramName, List <String> paramDescription, List <String> paramDefaultValue) { TDAPIOLELib.TestParameterFactory OTestParamFactory; TDAPIOLELib.ISupportTestParameters OISupportTestParams; TDAPIOLELib.TestParameter OTestParameter; OISupportTestParams = test as TDAPIOLELib.ISupportTestParameters; OTestParamFactory = OISupportTestParams.TestParameterFactory as TDAPIOLELib.TestParameterFactory; for (int Counter = 0; Counter < paramName.Count; Counter++) { OTestParameter = OTestParamFactory.AddItem(System.DBNull.Value); OTestParameter.Name = paramName[Counter]; OTestParameter.Description = paramDescription[Counter]; OTestParameter.DefaultValue = paramDefaultValue[Counter]; OTestParameter.Post(); } return(true); }
/// <summary> /// Add a single design step to the test. Added design step will be the last design step. /// <para/> returns TDAPIOLELib.DesignStep Object /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="description">Description of the design step</param> /// <param name="expectedResult">Expected result of the design step</param> /// <param name="attachmentPath">attachment path of the design step</param> /// <returns>TDAPIOLELib.DesignStep Object</returns> public TDAPIOLELib.DesignStep AddSingleDeignStep(TDAPIOLELib.Test test, String description, String expectedResult, String attachmentPath = "") { TDAPIOLELib.DesignStep ODesignStep; TDAPIOLELib.DesignStepFactory ODesignStepFactory; ODesignStepFactory = test.DesignStepFactory; int StepCounter = ODesignStepFactory.NewList("").Count + 1; ODesignStep = ODesignStepFactory.AddItem(System.DBNull.Value); ODesignStep.StepName = "Step " + StepCounter; ODesignStep.StepDescription = description; ODesignStep.StepExpectedResult = expectedResult; ODesignStep.Post(); if (attachmentPath != "") { TDAPIOLELib.AttachmentFactory OAttachmentFactory; TDAPIOLELib.Attachment OAttachment; OAttachmentFactory = ODesignStep.Attachments; if (System.IO.File.Exists(attachmentPath)) { OAttachment = OAttachmentFactory.AddItem(System.DBNull.Value); OAttachment.FileName = attachmentPath; OAttachment.Type = Convert.ToInt16(TDAPIOLELib.tagTDAPI_ATTACH_TYPE.TDATT_FILE); OAttachment.Post(); } else { throw (new Exception("File Not Found : " + attachmentPath)); } } return(ODesignStep); }
/// <summary> /// Mark the test as Template test /// <para/> returns true is successfully /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <returns>true is successfully</returns> public Boolean MarkAsTemplate(TDAPIOLELib.Test test) { test.TemplateTest = true; test.Post(); return(true); }
/// <summary> /// Gets the list of design steps for the test object /// <para/> returns TDAPIOLELib.List. Each list item can be converted to the TDAPIOLELib.DesignStep /// </summary> /// <param name="test"></param> /// <returns>TDAPIOLELib.List. Each list item can be converted to the TDAPIOLELib.DesignStep</returns> public TDAPIOLELib.List GetDesignStepList(TDAPIOLELib.Test test) { return(test.DesignStepFactory.NewList("")); }
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"); }
/// <summary> /// Gets the list of defects linked to test /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <returns>TDAPIOLELib.List Object</returns> public TDAPIOLELib.List GetLinkedDefectsToTest(TDAPIOLELib.Test test) { return(GetLinkedDefectsToEntities(test)); }
/// <summary> /// Deletes all test attachments /// <para/> returns true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <returns>true if successfull</returns> public Boolean DeleteAllAttachments(TDAPIOLELib.Test test) { return(Utilities.DeleteAllAttachments(test.Attachments)); }
/// <summary> /// Adds attachment to the test. /// <para/> returns true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="attachmentsPath">List of all attachments to be added to test</param> /// <returns>true if successfull</returns> public Boolean AddAttachment(TDAPIOLELib.Test test, List <String> attachmentsPath) { return(Utilities.AddAttachment(test.Attachments, attachmentsPath)); }
/// <summary> /// Add test to requirement coverage /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="req">TDAPIOLELib.Req Object</param> /// <returns>True if successfull</returns> public Boolean AddTestToRequirementsCoverage(TDAPIOLELib.Test test, TDAPIOLELib.Req req) { TDAPIOLELib.ICoverableReq coverable = req as TDAPIOLELib.ICoverableReq; coverable.AddTestToCoverage(test.ID); return(true); }
/// <summary> /// Links Defect to Test /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="bug">TDAPIOLELib.Bug Object</param> /// <param name="comment">Comment</param> /// <returns>True if Successfull</returns> public Boolean LinkDefectToTest(TDAPIOLELib.Test test, TDAPIOLELib.Bug bug, String comment = "") { return(LinkDefectToEntities(test, bug, comment)); }
/// <summary> /// Search and delete test attachment using attachment name /// <para/> returns true if successfull /// </summary> /// <param name="test">TDAPIOLELib.Test Object</param> /// <param name="attachmentName">Name of the attachment</param> /// <returns>true if successfull</returns> public Boolean DeleteAttachmentByName(TDAPIOLELib.Test test, String attachmentName) { return(Utilities.DeleteAttachmentByName(test.Attachments, attachmentName)); }
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"); }
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_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"); }
/// <summary> /// Download attachments of a test case. /// <para/> returns true if the download is successfull /// </summary> /// <param name="test">TDAPIOLELib.Test test Object</param> /// <param name="attachmentDownloadPath">Folder path to download the attachments</param> /// <returns>true if the download is successfull</returns> public Boolean DownloadAttachments(TDAPIOLELib.Test test, String attachmentDownloadPath) { return(Utilities.DownloadAttachments(test.Attachments, attachmentDownloadPath)); }
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> /// Assign requirement to the test case /// <para/> returns true if successfull /// </summary> /// <param name="test"></param> /// <param name="requirement"></param> /// <returns>true if successfull</returns> public Boolean AssignRequirement(TDAPIOLELib.Test test, TDAPIOLELib.Req requirement) { TDAPIOLELib.ICoverableReq OICoverable = requirement as TDAPIOLELib.ICoverableReq; OICoverable.AddTestToCoverage(test.ID); return(true); }