internal static void OnBeforeRunStarted(object sender, RunStartedEventArgs eventArg) { try { BeforeRunStarted?.Invoke(sender, eventArg); } catch (Exception exp) { Logger.Error($"Exception occured in {nameof(OnBeforeRunStarted)} event handler: {exp}"); } }
private void StartRun(XmlDocument xmlDoc) { try { LaunchMode launchMode; if (Config.GetValue(ConfigurationPath.LaunchDebugMode, false)) { launchMode = LaunchMode.Debug; } else { launchMode = LaunchMode.Default; } var startLaunchRequest = new StartLaunchRequest { Name = Config.GetValue(ConfigurationPath.LaunchName, "NUnit Launch"), Description = Config.GetValue(ConfigurationPath.LaunchDescription, ""), StartTime = DateTime.UtcNow, Mode = launchMode, Tags = Config.GetValues(ConfigurationPath.LaunchTags, new List <string>()).ToList() }; var eventArg = new RunStartedEventArgs(Bridge.Service, startLaunchRequest); try { BeforeRunStarted?.Invoke(this, eventArg); } catch (Exception exp) { Console.WriteLine("Exception was thrown in 'BeforeRunStarted' subscriber." + Environment.NewLine + exp); } if (!eventArg.Canceled) { Bridge.Context.LaunchReporter = Bridge.Context.LaunchReporter ?? new LaunchReporter(Bridge.Service, Config, null); Bridge.Context.LaunchReporter.Start(eventArg.StartLaunchRequest); try { AfterRunStarted?.Invoke(this, new RunStartedEventArgs(Bridge.Service, startLaunchRequest, Bridge.Context.LaunchReporter, xmlDoc.OuterXml)); } catch (Exception exp) { Console.WriteLine("Exception was thrown in 'AfterRunStarted' subscriber." + Environment.NewLine + exp); } } } catch (Exception exception) { Console.WriteLine("ReportPortal exception was thrown." + Environment.NewLine + exception); } }
internal static void OnBeforeRunStarted(object sender, RunStartedEventArgs eventArg) { BeforeRunStarted?.Invoke(sender, eventArg); }