public void RunStarted(string name, int testCount) { var requestNewLaunch = new StartLaunchRequest { Name = Configuration.ReportPortal.Launch.Name, StartTime = DateTime.UtcNow }; if (Configuration.ReportPortal.Launch.DebugMode) { requestNewLaunch.Mode = LaunchMode.Debug; } requestNewLaunch.Tags = new List <string>(Configuration.ReportPortal.Launch.Tags.Split(',')); var eventArg = new RunStartedEventArgs(Bridge.Service, requestNewLaunch); if (BeforeRunStarted != null) { BeforeRunStarted(this, eventArg); } if (!eventArg.Canceled) { Bridge.Context.LaunchId = Bridge.Service.StartLaunch(requestNewLaunch).Id; if (AfterRunStarted != null) { AfterRunStarted(this, new RunStartedEventArgs(Bridge.Service, requestNewLaunch, Bridge.Context.LaunchId)); } } }
public static void BeforeTestRun() { if (Configuration.ReportPortal.Enabled) { var request = new StartLaunchRequest { Name = Configuration.ReportPortal.Launch.Name, StartTime = DateTime.UtcNow }; if (Configuration.ReportPortal.Launch.DebugMode) { request.Mode = LaunchMode.Debug; } request.Tags = new List <string>(Configuration.ReportPortal.Launch.Tags.Split(',')); var eventArg = new RunStartedEventArgs(Bridge.Service, request); ReportPortalAddin.OnBeforeRunStarted(null, eventArg); if (!eventArg.Canceled) { Bridge.Context.LaunchReporter = new LaunchReporter(Bridge.Service); Bridge.Context.LaunchReporter.Start(request); Bridge.Context.LaunchReporter.StartTask.Wait(); ReportPortalAddin.OnAfterRunStarted(null, new RunStartedEventArgs(Bridge.Service, request, Bridge.Context.LaunchReporter)); } } }
private void StartRun(XmlDocument xmlDoc) { try { LaunchMode launchMode; if (Config.Launch.IsDebugMode) { launchMode = LaunchMode.Debug; } else { launchMode = LaunchMode.Default; } var startLaunchRequest = new StartLaunchRequest { Name = Config.Launch.Name, Description = Config.Launch.Description, StartTime = DateTime.UtcNow, Mode = launchMode, Tags = Config.Launch.Tags }; var eventArg = new RunStartedEventArgs(Bridge.Service, startLaunchRequest); try { if (BeforeRunStarted != null) { BeforeRunStarted(this, eventArg); } } catch (Exception exp) { Console.WriteLine("Exception was thrown in 'BeforeRunStarted' subscriber." + Environment.NewLine + exp); } if (!eventArg.Canceled) { Bridge.Context.LaunchReporter = new LaunchReporter(Bridge.Service); Bridge.Context.LaunchReporter.Start(eventArg.Launch); try { if (AfterRunStarted != null) { AfterRunStarted(this, new RunStartedEventArgs(Bridge.Service, startLaunchRequest, Bridge.Context.LaunchReporter)); } } 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); } }
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 OnAfterRunStarted(object sender, RunStartedEventArgs eventArg) { try { AfterRunStarted?.Invoke(sender, eventArg); } catch (Exception exp) { Logger.Error($"Exception occured in {nameof(OnAfterRunStarted)} event handler: {exp}"); } }
public static void BeforeTestRun() { try { var config = Initialize(); var request = new StartLaunchRequest { Name = config.GetValue(ConfigurationPath.LaunchName, "SpecFlow Launch"), StartTime = DateTime.UtcNow }; if (config.GetValue(ConfigurationPath.LaunchDebugMode, false)) { request.Mode = LaunchMode.Debug; } request.Attributes = config.GetKeyValues("Launch:Attributes", new List <KeyValuePair <string, string> >()).Select(a => new ItemAttribute { Key = a.Key, Value = a.Value }).ToList(); request.Description = config.GetValue(ConfigurationPath.LaunchDescription, string.Empty); var eventArg = new RunStartedEventArgs(_service, request); ReportPortalAddin.OnBeforeRunStarted(null, eventArg); if (eventArg.LaunchReporter != null) { _launchReporter = eventArg.LaunchReporter; } if (!eventArg.Canceled) { Shared.Extensibility.Embedded.Analytics.AnalyticsReportEventsObserver.DefineConsumer("agent-dotnet-specflow"); _launchReporter = _launchReporter ?? new LaunchReporter(_service, config, null, Shared.Extensibility.ExtensionManager.Instance); _launchReporter.Start(request); ReportPortalAddin.OnAfterRunStarted(null, new RunStartedEventArgs(_service, request, _launchReporter)); } } catch (Exception exp) { _traceLogger.Error(exp.ToString()); } }
private static void ReportPortalAddin_BeforeRunStarted(object sender, RunStartedEventArgs e) { e.StartLaunchRequest.Description = $"OS: {Environment.OSVersion.VersionString}"; }
internal static void OnAfterRunStarted(object sender, RunStartedEventArgs eventArg) { AfterRunStarted?.Invoke(sender, eventArg); }
internal static void OnBeforeRunStarted(object sender, RunStartedEventArgs eventArg) { BeforeRunStarted?.Invoke(sender, eventArg); }