private void RunTests() { try { NotifyStartRunningTests(); _arkadeApi.RunTests(_testSession); _testSession.TestSummary = new TestSummary(_numberOfProcessedFiles, _numberOfProcessedRecords, _numberOfTestsFinished); _testSession.AddLogEntry("Test run completed."); SaveHtmlReport(); _testRunCompletedSuccessfully = true; _statusEventHandler.RaiseEventOperationMessage(Resources.GUI.TestrunnerFinishedOperationMessage, null, OperationMessageStatus.Ok); NotifyFinishedRunningTests(); } catch (ArkadeException e) { _testSession?.AddLogEntry("Test run failed: " + e.Message); _log.Error(e.Message, e); _statusEventHandler.RaiseEventOperationMessage(Resources.GUI.TestrunnerFinishedWithError, e.Message, OperationMessageStatus.Error); NotifyFinishedRunningTests(); } catch (Exception e) { _testSession?.AddLogEntry("Test run failed: " + e.Message); _log.Error(e.Message, e); var operationMessageBuilder = new StringBuilder(); if (e.GetType() == typeof(FileNotFoundException)) { string nameOfMissingFile = new FileInfo(((FileNotFoundException)e).FileName).Name; operationMessageBuilder.Append(string.Format(Resources.GUI.FileNotFoundMessage, nameOfMissingFile)); } else { operationMessageBuilder.Append(e.Message); } string fileName = new DetailedExceptionMessage(e).WriteToFile(); if (!string.IsNullOrEmpty(fileName)) { operationMessageBuilder.AppendLine("\n" + string.Format(Resources.GUI.DetailedErrorMessageInfo, fileName)); } string operationMessage = operationMessageBuilder.ToString(); _statusEventHandler.RaiseEventOperationMessage( Resources.GUI.TestrunnerFinishedWithError, operationMessage, OperationMessageStatus.Error ); NotifyFinishedRunningTests(); } }
public TestSession Build() { if (_archive == null) { _archive = new ArchiveBuilder().WithArchiveType(ArchiveType.Noark3).Build(); } var testSession = new TestSession(_archive); foreach (var logEntry in _logEntries) { testSession.AddLogEntry(logEntry); } TestSuite testSuite = new TestSuite(); if (_testRuns.Count != 0) { foreach (var testRun in _testRuns) { testSuite.AddTestRun(testRun); } } else { testSuite.AddTestRun(new TestRunBuilder().Build()); } testSession.TestSuite = testSuite; if (_testSummary == null) { _testSummary = new TestSummary(0, 0, 0); } testSession.TestSummary = _testSummary; return(testSession); }