internal static void OnAfterRunFinished(object sender, RunFinishedEventArgs eventArg)
 {
     try
     {
         AfterRunFinished?.Invoke(sender, eventArg);
     }
     catch (Exception exp)
     {
         Logger.Error($"Exception occured in {nameof(OnAfterRunFinished)} event handler: {exp}");
     }
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 internal static void OnAfterRunFinished(object sender, RunFinishedEventArgs eventArg)
 {
     AfterRunFinished?.Invoke(sender, eventArg);
 }