/// <summary> /// runs the tests given to the object. /// </summary> /// <returns></returns> public override TestSuiteRunResults Run() { if (!Connected) { return(null); } TestSuiteRunResults activeRunDesc = new TestSuiteRunResults(); //find all the testSets under if given some folders in our list try { FindAllTestSetsUnderFolders(); } catch (Exception ex) { ConsoleWriter.WriteErrLine(string.Format(Resources.AlmRunnerErrorBadQcInstallation, ex.Message, ex.StackTrace)); return(null); } //run all the TestSets foreach (string testset in TestSets) { string testset1 = testset.TrimEnd("\\".ToCharArray()); int pos = testset1.LastIndexOf('\\'); string tsDir = ""; string tsName = testset1; if (pos != -1) { tsDir = testset1.Substring(0, pos).Trim("\\".ToCharArray()); tsName = testset1.Substring(pos, testset1.Length - pos).Trim("\\".ToCharArray()); } TestSuiteRunResults desc = RunTestSet(tsDir, tsName, Timeout, RunMode, RunHost); if (desc != null) { activeRunDesc.AppendResults(desc); } } return(activeRunDesc); }
/// <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); } }
/// <summary> /// runs the tests given to the object. /// </summary> /// <returns></returns> public override TestSuiteRunResults Run() { if (!Connected) return null; TestSuiteRunResults activeRunDesc = new TestSuiteRunResults(); //find all the testSets under if given some folders in our list try { FindAllTestSetsUnderFolders(); } catch (Exception ex) { ConsoleWriter.WriteErrLine(string.Format(Resources.AlmRunnerErrorBadQcInstallation, ex.Message, ex.StackTrace)); return null; } //run all the TestSets foreach (string testset in TestSets) { string testset1 = testset.TrimEnd("\\".ToCharArray()); int pos = testset1.LastIndexOf('\\'); string tsDir = ""; string tsName = testset1; if (pos != -1) { tsDir = testset1.Substring(0, pos).Trim("\\".ToCharArray()); tsName = testset1.Substring(pos, testset1.Length - pos).Trim("\\".ToCharArray()); } TestSuiteRunResults desc = RunTestSet(tsDir, tsName, Timeout, RunMode, RunHost); if (desc != null) activeRunDesc.AppendResults(desc); } return activeRunDesc; }