Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
0
 /// <summary>
 /// Updates the field value for testset dabase fields
 /// <para/> returns true if successfull
 /// </summary>
 /// <param name="testSet">TDAPIOLELib.TestSet Object</param>
 /// <param name="fieldName">Database field name</param>
 /// <param name="newValue">new value for the test set field</param>
 /// <returns>true if successfull</returns>
 public Boolean UpdateFieldValue(TDAPIOLELib.TestSet testSet, String fieldName, String newValue, Boolean Post = true)
 {
     testSet[fieldName.ToUpper()] = newValue;
     if (Post)
     {
         testSet.Post();
     }
     return(true);
 }
Esempio n. 4
0
        /// <summary>
        /// Fail all tests under a testset
        /// <para/>returns true if successfull
        /// </summary>
        /// <param name="testSet">testset object</param>
        /// <returns>returns true if successfull</returns>
        public Boolean FailAllTests(TDAPIOLELib.TestSet testSet)
        {
            foreach (TDAPIOLELib.TSTest tsTest in GetAllTestInstance(testSet))
            {
                RunTestSetTest(tsTest.RunFactory, "Failed");
            }

            return(true);
        }
Esempio n. 5
0
 /// <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);
 }
Esempio n. 6
0
        /// <summary>
        /// Find tests under a test plan folder and them to testset
        /// <para/>returns true if successfull
        /// </summary>
        /// <param name="testSet">TDAPIOLELib.TestSet Object</param>
        /// <param name="testPlanFolderPath">Test plan folder path</param>
        /// <returns></returns>
        public Boolean AddAllTestsFromTestFolder(TDAPIOLELib.TestSet testSet, String testPlanFolderPath)
        {
            TestFolders testFolders = new TestFolders(tDConnection);

            foreach (TDAPIOLELib.Test OTest in testFolders.GetTests(testPlanFolderPath))
            {
                AddTest(testSet, OTest);
            }
            return(true);
        }
Esempio n. 7
0
 /// <summary>
 /// Deletes a test set
 /// <para/>returns true if successfull
 /// </summary>
 /// <param name="testSet"></param>
 /// <returns>true if successfull</returns>
 public Boolean Delete(TDAPIOLELib.TestSet testSet)
 {
     try
     {
         TDAPIOLELib.TestSetFactory testSetFactory = tDConnection.TestSetFactory;
         testSetFactory.RemoveItem(testSet.ID);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Create a new test set in the test plan
        /// <para/> returns TDAPIOLELib.TestSet object
        /// </summary>
        /// <param name="testSetDetails">Test set database fields with values</param>
        /// <param name="testSetFolderPath">Test lab Folder path for test set</param>
        /// <returns></returns>
        public TDAPIOLELib.TestSet Create(Dictionary <String, String> testSetDetails, String testSetFolderPath)
        {
            TDAPIOLELib.TestSetFactory testSetFactory = testLabFolders.GetTestSetFolder(testSetFolderPath).TestSetFactory;
            TDAPIOLELib.TestSet        testSet        = testSetFactory.AddItem(System.DBNull.Value);

            foreach (KeyValuePair <string, string> kvp in testSetDetails)
            {
                testSet[kvp.Key.ToUpper()] = kvp.Value;
            }

            //Post the test to ALM
            testSet.Post();
            return(testSet);
        }
Esempio n. 9
0
 /// <summary>
 /// Gets the list of defects linked to testset
 /// </summary>
 /// <param name="testSet">TDAPIOLELib.TestSet Object</param>
 /// <returns>TDAPIOLELib.List Object</returns>
 public TDAPIOLELib.List GetLinkedDefectsToTestSet(TDAPIOLELib.TestSet testSet)
 {
     return(GetLinkedDefectsToEntities(testSet));
 }
Esempio n. 10
0
 /// <summary>
 /// Links Defect to TestSet
 /// </summary>
 /// <param name="testSet">TDAPIOLELib.TestSet Object</param>
 /// <param name="bug">TDAPIOLELib.Bug Object</param>
 /// <param name="comment">Comment</param>
 /// <returns>True if Successfull</returns>
 public Boolean LinkDefectToTestSet(TDAPIOLELib.TestSet testSet, TDAPIOLELib.Bug bug, String comment = "")
 {
     return(LinkDefectToEntities(testSet, bug, comment));
 }
Esempio n. 11
0
 /// <summary>
 /// Get test instances from testset
 /// <para/>returns TDAPIOLELib.List. Each object from this list can be converted to TDAPIOLELib.TSTest
 /// </summary>
 /// <param name="testSet">test set object</param>
 /// <returns>TDAPIOLELib.List. Each object from this list can be converted to TDAPIOLELib.TSTest</returns>
 public TDAPIOLELib.List GetAllTestInstance(TDAPIOLELib.TestSet testSet)
 {
     TDAPIOLELib.TSTestFactory tSTestFactory = testSet.TSTestFactory;
     return(tSTestFactory.NewList(""));
 }
Esempio n. 12
0
 /// <summary>
 /// Delete test set attachment by name
 /// <para/> retruns true if successfull
 /// </summary>
 /// <param name="testSet">test set object</param>
 /// <param name="attachmentName">attachemnt name</param>
 /// <returns>true if successfull</returns>
 public Boolean DeleteAttachmentByName(TDAPIOLELib.TestSet testSet, String attachmentName)
 {
     return(Utilities.DeleteAttachmentByName(testSet.Attachments, attachmentName));
 }
Esempio n. 13
0
 /// <summary>
 /// Download all testset attachment
 /// </summary>
 /// <param name="testSet">TDAPIOLELib.TestSet Object</param>
 /// <param name="downloadPath">Path to dowsnload attachments</param>
 /// <returns>True if Successfull</returns>
 public Boolean DownloadAttachements(TDAPIOLELib.TestSet testSet, String downloadPath)
 {
     return(Utilities.DownloadAttachments(testSet.Attachments, downloadPath));
 }
Esempio n. 14
0
 /// <summary>
 /// Delete all attachmentsfrom test set
 /// <para/>returns true if successfull
 /// </summary>
 /// <param name="testSet">test set object</param>
 /// <returns>returns true if successfull</returns>
 public Boolean DeleteAllAttachments(TDAPIOLELib.TestSet testSet)
 {
     return(Utilities.DeleteAllAttachments(testSet.Attachments));
 }
Esempio n. 15
0
 /// <summary>
 /// Get Testlab folder path for test set
 /// <para/>returns String folder path
 /// </summary>
 /// <param name="testSet">TDAPIOLELib.TestSet Object</param>
 /// <returns>String folder path</returns>
 public String GetFolderPath(TDAPIOLELib.TestSet testSet)
 {
     TDAPIOLELib.TestSetFolder testSetFolder = testSet.TestSetFolder;
     return(testSetFolder.Path.ToString());
 }
Esempio n. 16
0
        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");
        }
Esempio n. 17
0
        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");
        }
Esempio n. 18
0
 /// <summary>
 /// Add Attachment to test set
 /// <para/>return true if successfull
 /// </summary>
 /// <param name="testSet">test set object</param>
 /// <param name="attachMentsPath">list of all attachments</param>
 /// <returns>true if successfull</returns>
 public Boolean AddAttachments(TDAPIOLELib.TestSet testSet, List <String> attachMentsPath)
 {
     return(Utilities.AddAttachment(testSet.Attachments, attachMentsPath));
 }