internal static void OnBeforeRunFinished(object sender, RunFinishedEventArgs eventArg) { try { BeforeRunFinished?.Invoke(sender, eventArg); } catch (Exception exp) { Logger.Error($"Exception occured in {nameof(OnBeforeRunFinished)} event handler: {exp}"); } }
private void FinishRun(XmlDocument xmlDoc) { try { var finishLaunchRequest = new FinishLaunchRequest { EndTime = DateTime.UtcNow, }; var eventArg = new RunFinishedEventArgs(Bridge.Service, finishLaunchRequest, Bridge.Context.LaunchReporter, xmlDoc.OuterXml); try { BeforeRunFinished?.Invoke(this, eventArg); } catch (Exception exp) { Console.WriteLine("Exception was thrown in 'BeforeRunFinished' subscriber." + Environment.NewLine + exp); } if (!eventArg.Canceled) { var sw = Stopwatch.StartNew(); Console.Write("Finishing to send the results to Report Portal... "); Bridge.Context.LaunchReporter.Finish(finishLaunchRequest); Bridge.Context.LaunchReporter.Sync(); Console.WriteLine($"Elapsed: {sw.Elapsed}"); try { AfterRunFinished?.Invoke(this, new RunFinishedEventArgs(Bridge.Service, finishLaunchRequest, Bridge.Context.LaunchReporter, xmlDoc.OuterXml)); } catch (Exception exp) { Console.WriteLine("Exception was thrown in 'AfterRunFinished' subscriber." + Environment.NewLine + exp); } } } catch (Exception exception) { Console.WriteLine("ReportPortal exception was thrown." + Environment.NewLine + exception); } }
internal static void OnBeforeRunFinished(object sender, RunFinishedEventArgs eventArg) { BeforeRunFinished?.Invoke(sender, eventArg); }