internal CompareResult RunTests(List <TestDescription> testsToRun, ArgsProcessor argProc) { ReportSet reportSet = CreateReport(argProc); try { var watch = Stopwatch.StartNew(); using (_driver = new BrowserDriver()) { foreach (var test in testsToRun) { Outputter.Output("Running test: " + test.Name + " - " + test.Description); reportSet.OverallResult = RunTest(argProc, reportSet.OverallResult, reportSet, test); Outputter.OutputSeparator(); } watch.Stop(); reportSet.Duration = watch.Elapsed; if (argProc.IsOptionOn(ArgsProcessor.Options.Run)) { CreateReports(argProc, reportSet); } } } catch (Exception ex) { reportSet.Exception = ex.Message; throw; } finally { _driver = null; //try to log the exception in the combined report: AppendResultToCombinedReport(reportSet, argProc); } return(reportSet.OverallResult); }
private static CompareResult RunTests(ArgsProcessor argProc) { List <TestDescription> testsToRun = ReadTests(argProc); if (argProc.IsOptionOn(ArgsProcessor.Options.Save)) { //protect the saved 'expected' files, by prompting the user: var message = "Get new saved 'expected' images? [Y to continue]"; if (!IsUserOkToContinue(message)) { Outputter.Output("Cancelling..."); return(CompareResult.Cancelled); } } Outputter.OutputSeparator(); var runner = new TestRunner(); var result = runner.RunTests(testsToRun, argProc); Outputter.Output("Finished running tests:"); Outputter.Output("[" + CompareResultHelper.GetResultAsString(result) + "]", CompareResultHelper.GetResultAsConsoleColor(result)); return(result); }