Enable() public static method

public static Enable ( ) : bool
return bool
コード例 #1
0
        /// <summary>
        /// analyzes and runs the tests given in the param file.
        /// </summary>
        public void Run()
        {
            _ciRun = true;
            if (_runtype == TestStorageType.Unknown)
            {
                Enum.TryParse <TestStorageType>(_ciParams["runType"], true, out _runtype);
            }
            if (_runtype == TestStorageType.Unknown)
            {
                WriteToConsole(Resources.LauncherNoRuntype);
                return;
            }

            if (!_ciParams.ContainsKey("resultsFilename"))
            {
                WriteToConsole(Resources.LauncherNoResFilenameFound);
                return;
            }
            string resultsFilename = _ciParams["resultsFilename"];

            if (_ciParams.ContainsKey("uniqueTimeStamp"))
            {
                UniqueTimeStamp = _ciParams["uniqueTimeStamp"];
            }
            else
            {
                UniqueTimeStamp = resultsFilename.ToLower().Replace("results", "").Replace(".xml", "");
            }

            //create the runner according to type
            IAssetRunner runner = CreateRunner(_runtype, _ciParams);

            //runner instantiation failed (no tests to run or other problem)
            if (runner == null)
            {
                Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
            }

            //run the tests!
            RunTests(runner, resultsFilename);

            //Console.WriteLine("Press any key to exit...");
            //Console.ReadKey();
            ConsoleQuickEdit.Enable();
            if (Launcher.ExitCode != ExitCodeEnum.Passed)
            {
                Environment.Exit((int)Launcher.ExitCode);
            }
        }
コード例 #2
0
        /// <summary>
        /// analyzes and runs the tests given in the param file.
        /// </summary>
        public void Run()
        {
            _ciRun = true;
            if (_runType == TestStorageType.Unknown)
            {
                Enum.TryParse <TestStorageType>(_ciParams["runType"], true, out _runType);
            }
            if (_runType == TestStorageType.Unknown)
            {
                WriteToConsole(Resources.LauncherNoRuntype);
                return;
            }

            if (!_ciParams.ContainsKey("resultsFilename"))
            {
                WriteToConsole(Resources.LauncherNoResFilenameFound);
                return;
            }
            string resultsFilename = _ciParams["resultsFilename"];

            UniqueTimeStamp = _ciParams.ContainsKey("uniqueTimeStamp") ? _ciParams["uniqueTimeStamp"] : resultsFilename.ToLower().Replace("results", "").Replace(".xml", "");

            //run the entire set of test once
            //create the runner according to type
            IAssetRunner runner = CreateRunner(_runType, _ciParams, true);

            //runner instantiation failed (no tests to run or other problem)
            if (runner == null)
            {
                Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
            }

            TestSuiteRunResults results = runner.Run();

            RunTests(runner, resultsFilename, results);


            if (_runType.Equals(TestStorageType.FileSystem))
            {
                string onCheckFailedTests = (_ciParams.ContainsKey("onCheckFailedTest") ? _ciParams["onCheckFailedTest"] : "");

                _rerunFailedTests = !string.IsNullOrEmpty(onCheckFailedTests) && Convert.ToBoolean(onCheckFailedTests.ToLower());


                //the "On failure" option is selected and the run build contains failed tests
                if (_rerunFailedTests.Equals(true) && Launcher.ExitCode != ExitCodeEnum.Passed)
                {
                    ConsoleWriter.WriteLine("There are failed tests. Rerun the selected tests.");

                    //rerun the selected tests (either the entire set or just the selected ones)
                    //create the runner according to type
                    runner = CreateRunner(_runType, _ciParams, false);

                    //runner instantiation failed (no tests to run or other problem)
                    if (runner == null)
                    {
                        Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
                    }

                    TestSuiteRunResults rerunResults = runner.Run();
                    results.AppendResults(rerunResults);
                    RunTests(runner, resultsFilename, results);
                }
            }

            ConsoleQuickEdit.Enable();
            if (Launcher.ExitCode != ExitCodeEnum.Passed)
            {
                Environment.Exit((int)Launcher.ExitCode);
            }
        }
コード例 #3
0
        /// <summary>
        /// analyzes and runs the tests given in the param file.
        /// </summary>
        public void Run()
        {
            _ciRun = true;
            if (_runtype == TestStorageType.Unknown)
            {
                Enum.TryParse <TestStorageType>(_ciParams["runType"], true, out _runtype);
            }
            if (_runtype == TestStorageType.Unknown)
            {
                WriteToConsole(Resources.LauncherNoRuntype);
                return;
            }

            if (!_ciParams.ContainsKey("resultsFilename"))
            {
                WriteToConsole(Resources.LauncherNoResFilenameFound);
                return;
            }
            string resultsFilename = _ciParams["resultsFilename"];

            if (_ciParams.ContainsKey("uniqueTimeStamp"))
            {
                UniqueTimeStamp = _ciParams["uniqueTimeStamp"];
            }
            else
            {
                UniqueTimeStamp = resultsFilename.ToLower().Replace("results", "").Replace(".xml", "");
            }

            bool initialTestRun = true;

            //run the entire set of test once
            //create the runner according to type
            IAssetRunner runner = CreateRunner(_runtype, _ciParams, initialTestRun);

            //runner instantiation failed (no tests to run or other problem)
            if (runner == null)
            {
                Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
            }

            RunTests(runner, resultsFilename);


            if (_runtype.Equals(TestStorageType.Alm))
            {
                bool   filterSelected;
                string filter = (_ciParams.ContainsKey("FilterTests") ? _ciParams["FilterTests"] : "");

                if (string.IsNullOrEmpty(filter))
                {
                    filterSelected = false;
                }
                else
                {
                    filterSelected = Convert.ToBoolean(filter.ToLower());
                }

                if (filterSelected.Equals(true) && Launcher.ExitCode != ExitCodeEnum.Passed)
                {
                    //rerun selected tests
                    initialTestRun = false;

                    runner = CreateRunner(_runtype, _ciParams, initialTestRun);

                    //runner instantiation failed (no tests to run or other problem)
                    if (runner == null)
                    {
                        Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
                    }

                    RunTests(runner, resultsFilename);
                }
            }

            if (_runtype.Equals(TestStorageType.FileSystem))
            {
                string onCheckFailedTests = (_ciParams.ContainsKey("onCheckFailedTest") ? _ciParams["onCheckFailedTest"] : "");

                if (string.IsNullOrEmpty(onCheckFailedTests))
                {
                    rerunFailedTests = false;
                }
                else
                {
                    rerunFailedTests = Convert.ToBoolean(onCheckFailedTests.ToLower());
                }


                //the "On failure" option is selected and the run build contains failed tests
                if (rerunFailedTests.Equals(true) && Launcher.ExitCode != ExitCodeEnum.Passed)
                {
                    ConsoleWriter.WriteLine("There are failed tests. Rerun the selected tests.");

                    initialTestRun = false;

                    //rerun the selected tests (either the entire set or just the selected ones)
                    //create the runner according to type
                    runner = CreateRunner(_runtype, _ciParams, initialTestRun);

                    //runner instantiation failed (no tests to run or other problem)
                    if (runner == null)
                    {
                        Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
                    }

                    RunTests(runner, resultsFilename);
                }
            }

            //Console.WriteLine("Press any key to exit...");
            //Console.ReadKey();
            ConsoleQuickEdit.Enable();
            if (Launcher.ExitCode != ExitCodeEnum.Passed)
            {
                Environment.Exit((int)Launcher.ExitCode);
            }
        }