Esempio n. 1
0
        private static List <TestCase> readExecDataSheet(ExcelPackage package, List <TestCase> testCases)
        {
            int r = 2;

            while (true)
            {
                ExecStep data  = new ExecStep();
                string   value = string.Empty;
                bool     exist = readData(package, 2, r, 1, out value);

                if (exist)
                {
                    data.ID = value;
                }
                else
                {
                    break;
                }

                exist = readData(package, 2, r, 2, out value);

                if (!exist)
                {
                    r++;
                    continue;
                }

                TestCase testCase = testCases.SingleOrDefault(t => t.Name.ToLower() == value.ToLower());
                if (testCase == null || string.IsNullOrWhiteSpace(testCase.Name))
                {
                    r++;
                    continue;
                }

                exist = readData(package, 2, r, 3, out value);

                if (exist)
                {
                    data.ExecDataType = (ExecStep.ExecType)Enum.Parse(typeof(ExecStep.ExecType), value);
                }

                readData(package, 2, r, 4, out value);
                data.URL = value;


                //TODO: read username and password

                readData(package, 2, r, 7, out value);

                int intWait = 0;
                int.TryParse(value, out intWait);
                data.WaitPeriod = intWait;

                testCase.ExecutionSteps.Add(data);

                r++;
            }

            return(testCases);
        }
Esempio n. 2
0
        private static IWebElement executeInputStep(IWebDriver driver, ExecStep step)
        {
            IWebElement query = null;

            foreach (var element in step.InputElements)
            {
                if (element.ElementType != Element.ElementTypes.TextBox)
                {
                    continue;
                }

                query = findElementByIdentifier(driver, element);

                query.SendKeys(element.Value);
            }

            return(query);
        }