Exemplo n.º 1
0
        public void Setup()
        {
            Logger logger = new Logger();

            string path = AppDomain.CurrentDomain.BaseDirectory;

            PropertiesReader config = new PropertiesReader("Data\\config.txt");

            Properties props = new Properties
            {
                PersonalAccessToken = config.get("personalaccesstoken"),
                TestPlanId          = Convert.ToInt32(config.get("testplanid")),
                TestSuiteId         = Convert.ToInt32(config.get("testsuiteid")),
                Project             = config.get("project"),
                Uri          = config.get("server"),
                SaveLocation = path + "\\Output\\",
                FileName     = StringTools.addExtension(config.get("fileName"), "xlsx")
            };

            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.Logger             = logger;

            _contractAndMectRequirementExcelTools = new ContractAndMectRequirementExcelTools(props);
        }
Exemplo n.º 2
0
        public DocX CreateWordDoc(int testCaseId, int suiteID)
        {
            #region Pull Test Case from TFS
            PropertiesReader config = new PropertiesReader("config.txt");

            Properties props = new Properties();
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");;
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.TestPlanId         = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId        = Convert.ToInt32(config.get("testsuiteid"));

            Logger logger = new Logger(props.SaveLocation);

            props.Logger = logger;

            TestCase thisTestCase = new TestCase();
            RequirementsTraceabilityJobs requirementsTraceabilityJob = new RequirementsTraceabilityJobs(props);
            thisTestCase = requirementsTraceabilityJob.GetSingleTestCase(testCaseId, suiteID);

            Color  royalBlue    = Color.FromName("RoyalBlue");
            Color  white        = Color.FromName("White");
            string testName     = thisTestCase.TestCaseId.ToString() + "_" + thisTestCase.TestCaseName.Replace(" ", "_") + ".docx";
            DocX   doc          = DocX.Create(testName);
            var    columnWidths = new float[] { 225f, 225f, 225f };
            Table  testSummary  = doc.AddTable(2, 3);
            //Test Objective table
            doc.InsertParagraph("Test Objective").FontSize(16);
            testSummary.Rows[0].Cells[0].Paragraphs.First().Append("#").Color(white);
            testSummary.Rows[0].Cells[1].Paragraphs.First().Append("Title").Color(white);
            testSummary.Rows[0].Cells[2].Paragraphs.First().Append("Test Objective").Color(white);
            testSummary.Rows[0].Cells[0].FillColor = royalBlue;
            testSummary.Rows[0].Cells[1].FillColor = royalBlue;
            testSummary.Rows[0].Cells[2].FillColor = royalBlue;

            testSummary.Rows[1].Cells[0].Paragraphs.First().Append(thisTestCase.TestCaseId.ToString());
            testSummary.Rows[1].Cells[1].Paragraphs.First().Append(thisTestCase.TestDescription);
            testSummary.Rows[1].Cells[2].Paragraphs.First().Append(thisTestCase.TestObjective);
            testSummary.SetWidths(columnWidths);
            doc.InsertTable(testSummary);
            doc.InsertParagraph("Steps to follow").FontSize(16);

            Table testActionResult = doc.AddTable(thisTestCase.TestSteps.Count + 1, 3);

            testActionResult.SetWidths(columnWidths);
            testActionResult.Rows[0].Cells[0].Paragraphs.First().Append("Steps").Color(white);
            testActionResult.Rows[0].Cells[1].Paragraphs.First().Append("Action").Color(white);
            testActionResult.Rows[0].Cells[2].Paragraphs.First().Append("Expected Result").Color(white);
            testActionResult.Rows[0].Cells[0].FillColor = royalBlue;
            testActionResult.Rows[0].Cells[1].FillColor = royalBlue;
            testActionResult.Rows[0].Cells[2].FillColor = royalBlue;

            int i = 0;
            foreach (TestStep testStep in thisTestCase.TestSteps)
            {
                i++;
                string action   = Utility.RemoveTags(testStep.Action);
                string expected = Utility.RemoveTags(testStep.Expected);

                testActionResult.Rows[i].Cells[0].Paragraphs.First().Append(testStep.StepNumber.ToString());
                testActionResult.Rows[i].Cells[1].Paragraphs.First().Append(action);
                testActionResult.Rows[i].Cells[2].Paragraphs.First().Append(expected);
            }

            doc.InsertTable(testActionResult);
            #endregion
            return(doc);
        }
Exemplo n.º 3
0
        public void CreateWordDocSuite(string userName, int planID, int suiteID, bool claims)
        {
            #region Boring stuff
            // Test Case Pull
            #region Pull Test Case from TFS
            PropertiesReader config = new PropertiesReader("config.txt");

            Properties props = new Properties();
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");;
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.TestPlanId         = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId        = Convert.ToInt32(config.get("testsuiteid"));

            #endregion

            Color royalBlue = Color.FromName("RoyalBlue");
            Color white     = Color.FromName("White");

            string location = "C:\\Users\\" + userName + "\\Desktop\\EvidenceSuite " + suiteID;

            Logger logger = new Logger(location + "\\");

            props.Logger = logger;

            RequirementsTraceabilityJobs requirementsTraceabilityJob = new RequirementsTraceabilityJobs(props);
            System.IO.Directory.CreateDirectory(location);

            List <TestCase> cases = new List <TestCase>();
            cases = requirementsTraceabilityJob.GetTestCaseGivenPlanSuite(planID, suiteID);

            foreach (TestCase testCase in cases)
            {
                string fileName  = "";
                int    currentID = testCase.TestCaseId;
                string testName  = testCase.TestCaseId.ToString() + "_" + testCase.TestCaseName.Replace("<", "Less Than").Replace(">", "Greater Than").Replace(" ", "_").Replace(")", "_").Replace("(", "_").Replace("/", "_").Replace("\\", "_").Replace(" - ", "_").Replace("\"", "_").Replace("'", "_").Replace("▪", "_").Replace("*", "_");
                if (testName.Length > 150)
                {
                    fileName = testName.Substring(0, 150);
                }
                else
                {
                    fileName = testName;
                }

                DocX  doc          = DocX.Create(testName);
                var   columnWidths = new float[] { 225f, 225f, 400f };
                Table testSummary  = doc.AddTable(2, 3);
                //Test Objective table

                try
                {
                    string TestDescription = testCase.TestDescription.Replace("<br>&gt;", "\n >").Replace("&nbsp;", "").Replace("&nbsp", "").Replace("&gt", ">").Replace("&gt;", ">").Replace("<br> &nbsp ", "\n").Replace("condiditons", "conditions").Replace("&lt;", "<").Replace("<br>", "\n").Replace(";", "").Replace("	", " ");
                    doc.InsertParagraph("Test Objective").FontSize(16);
                    testSummary.Rows[0].Cells[0].Paragraphs.First().Append("#").Color(white);
                    testSummary.Rows[0].Cells[1].Paragraphs.First().Append("Title").Color(white);
                    testSummary.Rows[0].Cells[2].Paragraphs.First().Append("Test Objective").Color(white);
                    testSummary.Rows[0].Cells[0].FillColor = royalBlue;
                    testSummary.Rows[0].Cells[1].FillColor = royalBlue;
                    testSummary.Rows[0].Cells[2].FillColor = royalBlue;

                    testSummary.Rows[1].Cells[0].Paragraphs.First().Append(testCase.TestCaseId.ToString());
                    testSummary.Rows[1].Cells[1].Paragraphs.First().Append(TestDescription);
                    testSummary.Rows[1].Cells[2].Paragraphs.First().Append(testCase.TestObjective);
                }catch (NullReferenceException e)
                {
                    doc.InsertParagraph("Test Objective").FontSize(16);
                    testSummary.Rows[0].Cells[0].Paragraphs.First().Append("#").Color(white);
                    testSummary.Rows[0].Cells[1].Paragraphs.First().Append("Title").Color(white);
                    testSummary.Rows[0].Cells[2].Paragraphs.First().Append("Test Objective").Color(white);
                    testSummary.Rows[0].Cells[0].FillColor = royalBlue;
                    testSummary.Rows[0].Cells[1].FillColor = royalBlue;
                    testSummary.Rows[0].Cells[2].FillColor = royalBlue;

                    testSummary.Rows[1].Cells[0].Paragraphs.First().Append(testCase.TestCaseId.ToString());
                    testSummary.Rows[1].Cells[1].Paragraphs.First().Append("Test description is empty");
                    testSummary.Rows[1].Cells[2].Paragraphs.First().Append(testCase.TestObjective);
                }

                testSummary.SetWidths(columnWidths);
                doc.InsertTable(testSummary);


                doc.InsertParagraph("Steps to follow").FontSize(16);
                Table testActionResult;
                if (!claims)
                {
                    testActionResult = doc.AddTable(testCase.TestSteps.Count + 1, 3);
                    //Console.WriteLine("Create three rows");
                }
                else
                {
                    testActionResult = doc.AddTable(testCase.TestSteps.Count + 1, 4);
                    //Console.WriteLine("Create four rows");
                }
                testActionResult.SetWidths(columnWidths);
                testActionResult.Rows[0].Cells[0].Paragraphs.First().Append("Steps").Color(white);
                testActionResult.Rows[0].Cells[1].Paragraphs.First().Append("Action").Color(white);
                testActionResult.Rows[0].Cells[2].Paragraphs.First().Append("Expected Result").Color(white);
                testActionResult.Rows[0].Cells[0].FillColor = royalBlue;
                testActionResult.Rows[0].Cells[1].FillColor = royalBlue;
                testActionResult.Rows[0].Cells[2].FillColor = royalBlue;

                if (claims)
                {
                    testActionResult.Rows[0].Cells[3].Paragraphs.First().Append("Actual Result").Color(white);
                    testActionResult.Rows[0].Cells[3].FillColor = royalBlue;
                }
                int i = 0;

                if (testCase.TestSteps.Count <= 0)
                {
                    testSummary.Rows[1].Cells[0].Paragraphs.First().Append("Test ");
                    testSummary.Rows[1].Cells[1].Paragraphs.First().Append("Test ");
                    testSummary.Rows[1].Cells[2].Paragraphs.First().Append("Test ");
                    //if (claims)
                    //{
                    //    testSummary.Rows[1].Cells[3].Paragraphs.First().Append("Test ");
                    //}
                }
                else
                {
                    foreach (TestStep testStep in testCase.TestSteps)
                    {
                        i++;
                        string action   = Utility.RemoveTags(testStep.Action).Replace("<br>&gt;", "\n >").Replace("&nbsp;", "").Replace("&nbsp", "").Replace("&gt", ">").Replace("&gt;", ">").Replace("<br> &nbsp ", "\n").Replace("condiditons", "conditions").Replace("&lt;", "<").Replace("<br>", "\n").Replace(";", "").Replace("	", " ");
                        string expected = Utility.RemoveTags(testStep.Expected).Replace("<br>&gt;", "\n >").Replace("&nbsp;", "").Replace("&nbsp", "").Replace("&gt", ">").Replace("&gt;", ">").Replace("<br> &nbsp ", "\n").Replace("condiditons", "conditions").Replace("&lt;", "<").Replace("<br>", "\n").Replace(";", "").Replace("	", " ");

                        //Console.WriteLine("Test Step " + i);
                        testActionResult.Rows[i].Cells[0].Paragraphs[0].Append(testStep.StepNumber.ToString());
                        testActionResult.Rows[i].Cells[1].Paragraphs.First().Append(action);
                        testActionResult.Rows[i].Cells[2].Paragraphs.First().Append(expected);
                        if (claims)
                        {
                            testActionResult.Rows[i].Cells[3].Paragraphs.First();
                        }
                    }
                }

                doc.InsertTable(testActionResult);
                try
                {
                    doc.SaveAs(location + "//" + fileName + ".docx");
                }catch (Exception e)
                {
                    Console.WriteLine("Unable to make test case " + testCase.TestCaseId + " due to invalid name");
                }
            }
            ;
            #endregion
        }
Exemplo n.º 4
0
        public void CreateWordDocSuite(string userName, int planID, int suiteID)
        {
            #region Boring stuff
            // Test Case Pull
            #region Pull Test Case from TFS
            PropertiesReader config = new PropertiesReader("config.txt");

            Properties props = new Properties();
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");;
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.TestPlanId         = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId        = Convert.ToInt32(config.get("testsuiteid"));

            Logger logger = new Logger(props.SaveLocation);

            props.Logger = logger;
            #endregion
            Color royalBlue = Color.FromName("RoyalBlue");
            Color white     = Color.FromName("White");
            RequirementsTraceabilityJobs requirementsTraceabilityJob = new RequirementsTraceabilityJobs(props);
            string location = "C:\\Users\\" + userName + "\\Desktop\\Evidence Docs for Suite " + suiteID;
            System.IO.Directory.CreateDirectory(location);

            List <TestCase> cases = new List <TestCase>();
            cases = requirementsTraceabilityJob.GetTestCaseGivenPlanSuite(planID, suiteID);

            foreach (TestCase testCase in cases)
            {
                string testName     = testCase.TestCaseId.ToString() + "_" + testCase.TestCaseName.Replace(" ", "_").Replace(")", "_").Replace("(", "_").Replace("/", "_").Replace("\\", "_").Replace(" - ", "_").Replace("\"", "_").Replace("'", "_");
                DocX   doc          = DocX.Create(testName);
                var    columnWidths = new float[] { 225f, 225f, 225f };
                Table  testSummary  = doc.AddTable(2, 3);
                //Test Objective table

                string TestDescription = testCase.TestDescription.Replace("&nbsp", " ");
                doc.InsertParagraph("Test Objective").FontSize(16);
                testSummary.Rows[0].Cells[0].Paragraphs.First().Append("#").Color(white);
                testSummary.Rows[0].Cells[1].Paragraphs.First().Append("Title").Color(white);
                testSummary.Rows[0].Cells[2].Paragraphs.First().Append("Test Objective").Color(white);
                testSummary.Rows[0].Cells[0].FillColor = royalBlue;
                testSummary.Rows[0].Cells[1].FillColor = royalBlue;
                testSummary.Rows[0].Cells[2].FillColor = royalBlue;
                testSummary.Rows[1].Cells[0].Paragraphs.First().Append(testCase.TestCaseId.ToString());
                testSummary.Rows[1].Cells[1].Paragraphs.First().Append(testCase.TestDescription);
                testSummary.Rows[1].Cells[2].Paragraphs.First().Append(testCase.TestObjective);
                testSummary.SetWidths(columnWidths);
                doc.InsertTable(testSummary);


                doc.InsertParagraph("Steps to follow").FontSize(16);
                Table testActionResult = doc.AddTable(testCase.TestSteps.Count + 1, 3);
                testActionResult.SetWidths(columnWidths);
                testActionResult.Rows[0].Cells[0].Paragraphs.First().Append("Steps").Color(white);
                testActionResult.Rows[0].Cells[1].Paragraphs.First().Append("Action").Color(white);
                testActionResult.Rows[0].Cells[2].Paragraphs.First().Append("Expected Result").Color(white);
                testActionResult.Rows[0].Cells[0].FillColor = royalBlue;
                testActionResult.Rows[0].Cells[1].FillColor = royalBlue;
                testActionResult.Rows[0].Cells[2].FillColor = royalBlue;



                Console.WriteLine(testName);
                int i = 0;
                Console.WriteLine("Test Case Count " + testCase.TestSteps.Count);
                foreach (TestStep testStep in testCase.TestSteps)
                {
                    i++;
                    string action   = Utility.RemoveTags(testStep.Action);
                    string expected = Utility.RemoveTags(testStep.Expected);

                    testActionResult.Rows[i].Cells[0].Paragraphs[0].Append(testStep.StepNumber.ToString());
                    testActionResult.Rows[i].Cells[1].Paragraphs.First().Append(action);
                    testActionResult.Rows[i].Cells[2].Paragraphs.First().Append(expected);
                }

                doc.InsertTable(testActionResult);
                doc.SaveAs(location + "//" + testName + ".docx");
            }
            ;
            #endregion
        }
Exemplo n.º 5
0
        public void TestTFS()
        {
            #region Start up
            ExtentTest test = null;

            DateTime now      = DateTime.Now;
            string   testName = "TFSDoc";
            DocX     doc      = DocX.Create(testName);

            // Test Case Pull
            PropertiesReader config = new PropertiesReader("config.txt");

            Properties props = new Properties();
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");;
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.TestPlanId         = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId        = Convert.ToInt32(config.get("testsuiteid"));

            Logger logger = new Logger(props.SaveLocation);

            props.Logger = logger;

            TestCase thisTestCase = new TestCase();
            RequirementsTraceabilityJobs requirementsTraceabilityJob = new RequirementsTraceabilityJobs(props);
            thisTestCase = requirementsTraceabilityJob.GetSingleTestCase(152599, 152048);
            foreach (TestStep testStep in thisTestCase.TestSteps)
            {
                string action   = testStep.Action;
                string expected = testStep.Expected;
            }
            #endregion

            using (context)
            {
                context.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
                context.Url = "http://somedomain/url_that_delays_loading";
                IWebElement myDynamicElement = context.FindElement(By.Id("someDynamicElement"));
            }
            using (context)
            {
                context.Url = "http://somedomain/url_that_delays_loading";
                WebDriverWait wait             = new WebDriverWait(context, TimeSpan.FromSeconds(10));
                IWebElement   myDynamicElement = wait.Until <IWebElement>(d => d.FindElement(By.Id("someDynamicElement")));
            }

            try
            {
                foreach (TestStep testStep in thisTestCase.TestSteps)
                {
                    string    action   = testStep.Action;
                    string    expected = testStep.Expected;
                    Paragraph par      = doc.InsertParagraph(action + ": " + expected);
                }
                doc.Save();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Exemplo n.º 6
0
        public void CreateDoctest()
        {
            // Test Case Pull
            #region Pull Test Case from TFS
            PropertiesReader config  = new PropertiesReader("config.txt");
            Utility          utility = new Utility(context);
            Properties       props   = new Properties();
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");;
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.TestPlanId         = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId        = Convert.ToInt32(config.get("testsuiteid"));

            Logger logger = new Logger(props.SaveLocation);

            props.Logger = logger;

            TestCase thisTestCase = new TestCase();
            RequirementsTraceabilityJobs requirementsTraceabilityJob = new RequirementsTraceabilityJobs(props);
            thisTestCase = requirementsTraceabilityJob.GetSingleTestCase(152501, 152045);

            List <TestCase> cases = new List <TestCase>();
            cases = requirementsTraceabilityJob.GetTestCaseGivenPlanSuite(149579, 152045);

            string testName     = thisTestCase.TestCaseId.ToString() + "_" + thisTestCase.TestCaseName.Replace(" ", "_");
            DocX   doc          = DocX.Create(testName);
            var    columnWidths = new float[] { 225f, 225f, 225f };
            Table  testSummary  = doc.AddTable(2, 3);
            //Test Objective table

            doc.InsertParagraph("Test Objective").FontSize(16);
            testSummary.Rows[0].Cells[0].Paragraphs.First().Append("#");
            testSummary.Rows[0].Cells[1].Paragraphs.First().Append("Title");
            testSummary.Rows[0].Cells[2].Paragraphs.First().Append("Test Objective");

            testSummary.Rows[1].Cells[0].Paragraphs.First().Append(thisTestCase.TestCaseId.ToString());
            testSummary.Rows[1].Cells[1].Paragraphs.First().Append(thisTestCase.TestDescription);
            testSummary.Rows[1].Cells[2].Paragraphs.First().Append(thisTestCase.TestObjective);
            testSummary.SetWidths(columnWidths);
            doc.InsertTable(testSummary);
            doc.InsertParagraph("Steps to follow").FontSize(16);

            Table testActionResult = doc.AddTable(thisTestCase.TestSteps.Count + 1, 3);
            testActionResult.SetWidths(columnWidths);
            testActionResult.Rows[0].Cells[0].Paragraphs.First().Append("Steps");
            testActionResult.Rows[0].Cells[1].Paragraphs.First().Append("Action");
            testActionResult.Rows[0].Cells[2].Paragraphs.First().Append("Expected Result");

            int i = 0;
            foreach (TestStep testStep in thisTestCase.TestSteps)
            {
                i++;
                string action   = Utility.RemoveTags(testStep.Action);
                string expected = Utility.RemoveTags(testStep.Expected);

                testActionResult.Rows[i].Cells[0].Paragraphs.First().Append(testStep.StepNumber.ToString());
                testActionResult.Rows[i].Cells[1].Paragraphs.First().Append(action);
                testActionResult.Rows[i].Cells[2].Paragraphs.First().Append(expected);
            }

            doc.InsertTable(testActionResult);
            doc.Save();
            Process.Start("WINWORD.EXE", testName);
            #endregion
        }
Exemplo n.º 7
0
        public TestCase GetTestCase(int testCaseId, int suiteID)
        {
            #region Pull Test Case from TFS
            PropertiesReader config = new PropertiesReader("config.txt");

            Properties props = new Properties();
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");;
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");
            props.TestPlanId         = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId        = Convert.ToInt32(config.get("testsuiteid"));

            Logger logger = new Logger(props.SaveLocation);

            props.Logger = logger;

            TestCase thisTestCase = new TestCase();
            RequirementsTraceabilityJobs requirementsTraceabilityJob = new RequirementsTraceabilityJobs(props);
            thisTestCase = requirementsTraceabilityJob.GetSingleTestCase(testCaseId, suiteID);
            return(thisTestCase);
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            //string pat = "7wwgihgjbgchepkpvn4adotkd7bmt3ewtwsr7u4grny7yisrwe3a";
            //string server = "http://10.3.28.4/";
            //string project = "APHP Virginia";
            string saveLocation          = "C:\\Users\\cody.hui\\Desktop\\";
            string fileName              = "Test Status Report_Metrics_07MAY19";
            string fileNameWithExtension = StringTools.addExtension(fileName, "xlsx");
            //string testExecutionSheetName = "Test Execution";
            //string testScriptSheetName = "Test Script";
            //string inputtedStartDateTime = "4/1/2019";
            //string inputtedEndDateTime = "5/6/2019";
            //int testplan = 142838;
            //int testsuite = 149850;

            PropertiesReader config = new PropertiesReader("config.txt");

            Logger logger = new Logger(config.get("saveLocation"));

            Properties props = new Properties();

            props.Logger = logger;
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                = config.get("server");
            props.SaveLocation       = config.get("saveLocation");
            props.FileName           = StringTools.addExtension(config.get("fileName"), "xlsx");
            props.ExecutionSheetName = config.get("executionsheetname");
            props.ScriptSheetName    = config.get("scriptsheetname");

            string inputtedStartDateTime = config.get("startdate");
            string inputtedEndDateTime   = config.get("enddate");

            //if (!System.Diagnostics.Debugger.IsAttached)
            //{
            //    Console.Write("Enter file path: ");
            //    saveLocation = Console.ReadLine();

            //    Console.Write("Enter file name: ");
            //    fileName = Console.ReadLine();
            //    fileNameWithExtension = stringTool.addExtension(fileName, "xlsx");

            //    Console.Write("Enter Start Date: ");
            //    inputtedStartDateTime = Console.ReadLine();

            //    Console.Write("Enter End Date: ");
            //    inputtedEndDateTime = Console.ReadLine();
            //}

            ITFSReportingJobs reportingJobs = new TFSReportingJobs();

            //// If there is no Case ID for a Test Case on the Execution Input Data Sheet,
            //// then we will update the Test Case ID for that row (needs both Test Case Name and Test Suite ID)
            //reportingJobs.UpdateExcelTestCaseId(props);

            ////Gathers the 200 most recent Test Runs under the Test Plan ID and writes them to the DB
            //reportingJobs.GatherTestRunAndResultsAndWriteToDb(props);

            //// If the system sees that there are Test Cases in TFS for a certain iteration but it is not in the sheet,
            //// then we will add a row onto the spreadsheet for that single case.
            //// NOTE: It is possible to have duplicate Test Cases here if we have Test Cases without a Test Suite ID that
            //// match to a Test Case in TFS
            //reportingJobs.UpdateExcelExecutionInputData(props);

            // Update the Execution Actuals and Execution Input Data with the Test Results from the DB.
            reportingJobs.UpdateExcelDailyDefect(inputtedStartDateTime, inputtedEndDateTime, props);

            Console.WriteLine("All Tasks have finished...");
            Console.ReadLine();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            //string pat = "7wwgihgjbgchepkpvn4adotkd7bmt3ewtwsr7u4grny7yisrwe3a";
            //string server = "http://10.3.28.4/";
            //string project = "APHP Virginia";
            string saveLocation          = "C:\\Users\\cody.hui\\Desktop\\";
            string fileName              = "Test Status Report_Metrics_07MAY19";
            string fileNameWithExtension = StringTools.addExtension(fileName, "xlsx");
            //string testExecutionSheetName = "Test Execution";
            //string testScriptSheetName = "Test Script";
            //string inputtedStartDateTime = "4/1/2019";
            //string inputtedEndDateTime = "5/6/2019";
            //int testplan = 142838;
            //int testsuite = 149850;

            PropertiesReader config = new PropertiesReader("config.txt");

            Logger logger = new Logger(config.get("saveLocation"));

            Properties props = new Properties();

            props.Logger = logger;
            props.PersonalAccessToken = config.get("personalaccesstoken");
            props.TestPlanId          = Convert.ToInt32(config.get("testplanid"));
            props.TestSuiteId         = Convert.ToInt32(config.get("testsuiteid"));
            props.Project             = config.get("project");
            props.Uri                               = config.get("server");
            props.SaveLocation                      = config.get("saveLocation");
            props.FileName                          = StringTools.addExtension(config.get("fileName"), "xlsx");
            props.ExecutionSheetName                = config.get("executionsheetname");
            props.ScriptSheetName                   = config.get("scriptsheetname");
            props.UseWebApi                         = Convert.ToInt32(config.get("usewebapi"));
            props.NumberOfTestRun                   = Convert.ToInt32(config.get("numberoftestruns"));
            props.FolderCountsSheetName             = config.get("folderCountsSheetName");
            props.TfsDefectsSheetName               = config.get("tfsDefectsSheetName");
            props.TfsTestCaseWithDefectSheetName    = config.get("tfsTestCaseWithDefectSheetName");
            props.TfsDefectsProposedSheetName       = config.get("tfsDefectsProposedSheetName");
            props.ReadyForTestCriticalHighSheetName = config.get("readyForTestCritialHighSheetName");
            props.ReadyForTestMediumLowSheetName    = config.get("readyForTestMediumLowSheetName");
            props.StartDate                         = DateTime.Parse(config.get("startdate"));
            props.EndDate                           = DateTime.Parse(config.get("enddate"));

            string inputtedStartDateTime = config.get("startdate");
            string inputtedEndDateTime   = config.get("enddate");

            //if (!System.Diagnostics.Debugger.IsAttached)
            //{
            //    Console.Write("Enter file path: ");
            //    saveLocation = Console.ReadLine();

            //    Console.Write("Enter file name: ");
            //    fileName = Console.ReadLine();
            //    fileNameWithExtension = stringTool.addExtension(fileName, "xlsx");

            //    Console.Write("Enter Start Date: ");
            //    inputtedStartDateTime = Console.ReadLine();

            //    Console.Write("Enter End Date: ");
            //    inputtedEndDateTime = Console.ReadLine();
            //}

            ITFSReportingJobs reportingJobs = new TFSReportingJobs(props);

            //// If there is no Case ID for a Test Case on the Execution Input Data bSheet,
            //// then we will update the Test Case ID for that row (needs both Test Case Name and Test Suite ID)
            //reportingJobs.UpdateExcelTestCaseId(props);

            //Gathers the 200 most recent Test Runs under the Test Plan ID and writes them to the DB
            // --> TFSTools
            // --> WebAPITools (not required)
            // --> ExcelTools
            if (config.get("GatherTestRunAndResultsAndWriteToDb") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting GatherTestRunAndResultsAndWriteToDb");
                reportingJobs.GatherTestRunAndResultsAndWriteToDb();
                Console.WriteLine("Finished GatherTestRunAndResultsAndWriteToDb");
                Console.WriteLine("--------------------------------------------");
            }

            // If the system sees that there are Test Cases in TFS for a certain iteration but it is not in the sheet,
            // then we will add a row onto the spreadsheet for that single case.
            // NOTE: It is possible to have duplicate Test Cases here if we have Test Cases without a Test Suite ID that
            // match to a Test Case in TFS
            // --> TFSTools
            // --> WebAPITools (not required)
            // --> ExcelTools
            if (config.get("UpdateExcelExecutionInputData") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting UpdateExcelExecutionInputData");
                reportingJobs.UpdateExcelExecutionInputData();
                Console.WriteLine("Finished UpdateExcelExecutionInputData");
                Console.WriteLine("--------------------------------------------");
            }

            // Update the Execution Actuals and Execution Input Data with the Test Results from the DB.
            // --> TFSTools
            // --> WebAPITools (not required)
            // --> ExcelTools
            if (config.get("UpdateExcelDailyTestCaseRun") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting UpdateExcelDailyTestCaseRun");
                reportingJobs.UpdateExcelDailyTestCaseRun(inputtedStartDateTime, inputtedEndDateTime);
                Console.WriteLine("Finished UpdateExcelDailyTestCaseRun");
                Console.WriteLine("--------------------------------------------");
            }

            // Update the Daily Execution Status for the Overall and Daily Iteration status
            // --> WebAPITools
            // --> ExcelTools
            if (config.get("UpdateExcelDailyExecutionStatus") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting UpdateExcelDailyExecutionStatus");
                reportingJobs.UpdateExcelDailyExecutionStatus();
                Console.WriteLine("Finished UpdateExcelDailyExecutionStatus");
                Console.WriteLine("--------------------------------------------");
            }

            // Update both the Defects With Test Case count as well as the Test Cases linked with Defect sheets.
            // --> TFSTools
            // --> WebAPITools (not required)
            // --> ExcelTools
            if (config.get("UpdateExcelDefectWithTestCaseCount") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting UpdateExcelDefectWithTestCaseCount");
                reportingJobs.UpdateExcelDefectWithTestCaseCount();
                Console.WriteLine("Finished UpdateExcelDefectWithTestCaseCount");
                Console.WriteLine("--------------------------------------------");
            }

            // Update both of the Ready for Test Test Cases for Critical/High and Medium/Low defects.
            // --> WebAPITools
            // --> ExcelTools
            if (config.get("UpdateTestCasesReadyForTest") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting UpdateTestCasesReadyForTest");
                reportingJobs.UpdateTestCasesReadyForTest();
                Console.WriteLine("Finished UpdateTestCasesReadyForTest");
                Console.WriteLine("--------------------------------------------");
            }

            // Update the Folder Counts sheet with the Failed with Minor Defects count
            // --> WebAPITools
            // --> ExcelTools
            if (config.get("UpdateExcelFolderCounts") == "1")
            {
                Console.WriteLine("--------------------------------------------");
                Console.WriteLine("Starting UpdateExcelFolderCounts");
                reportingJobs.UpdateExcelFolderCounts();
                Console.WriteLine("Finished UpdateExcelFolderCounts");
                Console.WriteLine("--------------------------------------------");
            }

            Console.WriteLine("All Tasks have finished...");
            Console.ReadLine();
        }