Esempio n. 1
0
        public void UpdateAutomationIndicator()
        {
            ////Get all tests from ALM

            TDAPIOLELib.Recordset recordset = aLM_CORE.ExecuteQuery("Select TS_TEST_ID from test where TS_USER_TEMPLATE_06 is not null");
            Console.WriteLine(recordset.RecordCount);
            recordset.First();

            TDAPIOLELib.Test test;


            for (int Counter = 0; Counter < recordset.RecordCount; Counter++)
            {
                test = aLM_CORE.TestPlan.Test.GetObjectWithID(Convert.ToInt32(recordset[0]));

                if (test["TS_USER_TEMPLATE_06"] == "Y" && (test["TS_STATUS"] != "Ready For Automation" && test["TS_STATUS"] != "Automated"))
                {
                    Console.WriteLine(test.ID);
                    test["TS_STATUS"] = "Automated";
                    test.Post();
                }
                else if (test["TS_USER_TEMPLATE_06"] == "N" && (test["TS_STATUS"] != "Ready For Automation" && test["TS_STATUS"].ToString().ToUpper() != "Cannot be Automated".ToUpper()))
                {
                    Console.WriteLine(test.ID);
                    test["TS_STATUS"] = "Cannot be automated";
                    test.Post();
                }

                recordset.Next();
            }
        }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
0
 /// <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);
 }
Esempio n. 4
0
        public void Verify_Cycles()
        {
            Dictionary <String, String> releaseDetails = new Dictionary <string, string>();

            TDAPIOLELib.ReleaseFolder releaseFolder = aLM_CORE.Releases.ReleaseFolders.Create("Releases", "Dummy1");
            releaseDetails.Add("REL_NAME", "Release1");
            releaseDetails.Add("REL_START_DATE", DateTime.Now.ToShortDateString());
            releaseDetails.Add("REL_END_DATE", DateTime.Now.AddDays(10).ToShortDateString());
            TDAPIOLELib.Release release = aLM_CORE.Releases.Release.Create(releaseDetails, aLM_CORE.Releases.ReleaseFolders.GetPath(releaseFolder));

            TDAPIOLELib.Cycle cycle = aLM_CORE.Releases.Cycle.Create("Cycle1", release.StartDate, release.EndDate, release);

            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.Releases.Cycle.AddAttachment(cycle, Attach);

            aLM_CORE.Releases.Cycle.DownloadAttachments(cycle, "C:\\Temp\\ALMDOWNLOAD");

            aLM_CORE.Releases.Cycle.DeleteAttachmentByName(cycle, "DOC1.txt");
            aLM_CORE.Releases.Cycle.DeleteAllAttachments(cycle);

            TDAPIOLELib.Recordset ORec = aLM_CORE.Releases.Cycle.GetAllDetails(cycle);
            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();
            }

            release = aLM_CORE.Releases.Cycle.GetRelease(cycle);
            Console.WriteLine(release.Name);

            aLM_CORE.Releases.Cycle.Delete(cycle);
            aLM_CORE.Releases.Release.Delete(release);
            aLM_CORE.Releases.ReleaseFolders.Delete("Releases", "Dummy1");
        }
Esempio n. 5
0
        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");
        }
Esempio n. 6
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. 7
0
 /// <summary>
 /// Get all defect database field values. This Functions uses RecordSet object.
 /// <para/>You must have access to executing queries in ALM
 /// </summary>
 /// <param name="bug">TDAPIOLELib.Bug Object</param>
 /// <returns>true if successfull</returns>
 public TDAPIOLELib.Recordset GetAllDetails(TDAPIOLELib.Bug bug)
 {
     TDAPIOLELib.Recordset ORecordSet = Utilities.ExecuteQuery("Select * from Bug where BG_BUG_ID = " + bug.ID, tDConnection);
     ORecordSet.First();
     return(ORecordSet);
 }
Esempio n. 8
0
 /// <summary>
 /// Count all tests in TestPlan.
 /// <para/> returns Count of tests from test plan
 /// </summary>
 /// <returns>Count of tests from test plan</returns>
 public int CountAllTests()
 {
     TDAPIOLELib.Recordset ORecordSet = Utilities.ExecuteQuery("Select Count(*) from Test", tDConnection);
     ORecordSet.First();
     return(Convert.ToInt32(ORecordSet[0]));
 }