Ejemplo n.º 1
0
        private static int GetReturnCodeFromResult(SuiteResult result)
        {
            if (result.IsAllSuccess)
                return 0;

            return 1;
        }
Ejemplo n.º 2
0
        public static SuiteResult Execute(string suitePath, string baseUrl, string browserName)
        {
            BaseUrl = baseUrl;
            _storedValues = new Dictionary<string, string>();

            var result = new SuiteResult();
            var suite = SuiteLoader.LoadFromFile(suitePath);
            result.Name = suite.Name;

            using (var driver = (IWebDriver)Activator.CreateInstance(GetWebDriver(browserName)))
            {
                driver.Manage().Window.Maximize();
                driver.Navigate().GoToUrl(baseUrl);

                foreach (var test in suite.Tests)
                {
                    var testResult = TestExecutor.ExecuteTest(driver, test);
                    result.TestResults.Add(testResult);
                    result.IsAllSuccess = result.IsAllSuccess && !testResult.IsFailed;
                }
            }

            return result;
        }