예제 #1
0
        public static void GetExecutionTestCases()
        {
            ExecutionSession.lstTestCase = new List <TestCase>();
            TestCase    testCase;
            string      browser;
            string      priority;
            ExcelHelper excelHelper   = new ExcelHelper();
            string      execSheetName = HelperClass.runModuleToExecute + "$";

            if (!HelperClass.runAllTcs && HelperClass.runFailedTcs)
            {
                DialogResult dialogResult = MessageBox.Show("Are you sure you want to execute failed Test cases?", "Execution Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (dialogResult == DialogResult.No)
                {
                    Environment.Exit(0);
                }
            }
            string excelFilePath = string.Empty;

            if (HelperClass.runAllTcs || !HelperClass.runFailedTcs)
            {
                excelFilePath = HelperClass.runManagerPath;
            }
            else if (HelperClass.runFailedTcs)
            {
                excelFilePath = HelperClass.runFailedTCPath;
            }

            DataTable dt = excelHelper.ReadTable(excelFilePath, execSheetName, @"[Execute]=""Yes""");

            foreach (DataRow dRow in dt.Rows)
            {
                testCase = new TestCase();
                testCase.TestCaseName = Convert.ToString(dRow["Test Case Name"]);
                testCase.Category     = Convert.ToString(dRow["Category"]);
                browser = Convert.ToString(dRow["Browser"]);
                switch (browser)
                {
                case "FireFox":
                    testCase.Browser = Browser.FireFox;
                    break;

                case "Chrome":
                    testCase.Browser = Browser.Chrome;
                    break;

                case "IE":
                    testCase.Browser = Browser.IE;
                    break;

                case "Safari":
                    testCase.Browser = Browser.Safari;
                    break;
                }
                priority = Convert.ToString(dRow["Priority"]);
                switch (priority)
                {
                case "P1":
                    testCase.Priority = Priority.P1;
                    break;

                case "P2":
                    testCase.Priority = Priority.P2;
                    break;

                case "P3":
                    testCase.Priority = Priority.P3;
                    break;
                }
                if (Convert.ToString(dRow["RunIterations"]).Trim().ToLower() == "yes")
                {
                    testCase.RunIterations = true;
                }
                else
                {
                    testCase.RunIterations = false;
                }
                ExecutionSession.lstTestCase.Add(testCase);
            }
        }
예제 #2
0
 public static void AddFailedTCToExcel()
 {
     ExcelHelper.AddFailedTCToExcel();
 }