Exemplo n.º 1
0
        public static void AfterTestRun()
        {
            try
            {
                if (_launchReporter != null)
                {
                    var request = new FinishLaunchRequest
                    {
                        EndTime = DateTime.UtcNow
                    };

                    var eventArg = new RunFinishedEventArgs(_service, request, _launchReporter);
                    ReportPortalAddin.OnBeforeRunFinished(null, eventArg);

                    if (!eventArg.Canceled)
                    {
                        _launchReporter.Finish(request);

                        var sw = Stopwatch.StartNew();

                        _traceLogger.Info($"Finishing to send results to ReportPortal...");
                        _launchReporter.Sync();
                        _traceLogger.Info($"Elapsed: {sw.Elapsed}");
                        _traceLogger.Info(_launchReporter.StatisticsCounter.ToString());

                        ReportPortalAddin.OnAfterRunFinished(null, new RunFinishedEventArgs(_service, request, _launchReporter));
                    }
                }
            }
            catch (Exception exp)
            {
                _traceLogger.Error(exp.ToString());
            }
        }
Exemplo n.º 2
0
        public static void AfterTestRun()
        {
            if (Bridge.Context.LaunchReporter != null)
            {
                var request = new FinishLaunchRequest
                {
                    EndTime = DateTime.UtcNow
                };

                var eventArg = new RunFinishedEventArgs(Bridge.Service, request, Bridge.Context.LaunchReporter);
                if (BeforeRunFinished != null)
                {
                    BeforeRunFinished(null, eventArg);
                }
                if (!eventArg.Canceled)
                {
                    Bridge.Context.LaunchReporter.Finish(request);
                    Bridge.Context.LaunchReporter.FinishTask.Wait();

                    if (AfterRunFinished != null)
                    {
                        AfterRunFinished(null,
                                         new RunFinishedEventArgs(Bridge.Service, request, Bridge.Context.LaunchReporter));
                    }
                }
            }
        }
        private void RunFinished()
        {
            if (Bridge.Context.LaunchId != null)
            {
                var requestFinishLaunch = new FinishLaunchRequest
                {
                    EndTime = DateTime.UtcNow
                };

                var eventArg = new RunFinishedEventArgs(Bridge.Service, requestFinishLaunch, null, Bridge.Context.LaunchId);
                if (BeforeRunFinished != null)
                {
                    BeforeRunFinished(this, eventArg);
                }
                if (!eventArg.Canceled)
                {
                    var message = Bridge.Service.FinishLaunch(Bridge.Context.LaunchId, requestFinishLaunch);
                    if (AfterRunFinished != null)
                    {
                        AfterRunFinished(this, new RunFinishedEventArgs(Bridge.Service, requestFinishLaunch, message.Info, Bridge.Context.LaunchId));
                    }
                }

                _suiteIds = null;
                Bridge.Context.LaunchId = null;
            }
        }
Exemplo n.º 4
0
        public static void AfterTestRun()
        {
            if (Bridge.Context.LaunchId != null)
            {
                var request = new FinishLaunchRequest
                {
                    EndTime = DateTime.UtcNow
                };

                var eventArg = new RunFinishedEventArgs(Bridge.Service, request);
                if (BeforeRunFinished != null)
                {
                    BeforeRunFinished(null, eventArg);
                }
                if (!eventArg.Canceled)
                {
                    var message = Bridge.Service.FinishLaunch(Bridge.Context.LaunchId, request).Info;
                    if (AfterRunFinished != null)
                    {
                        AfterRunFinished(null, new RunFinishedEventArgs(Bridge.Service, request, message));
                    }

                    Bridge.Context.LaunchId = null;
                }
            }
        }
 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}");
     }
 }
Exemplo n.º 6
0
        private void FinishRun(XmlDocument xmlDoc)
        {
            try
            {
                var finishLaunchRequest = new FinishLaunchRequest
                {
                    EndTime = DateTime.UtcNow,
                };

                var eventArg = new RunFinishedEventArgs(Bridge.Service, finishLaunchRequest, Bridge.Context.LaunchReporter);
                try
                {
                    if (BeforeRunFinished != null)
                    {
                        BeforeRunFinished(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, force: false);
                    Bridge.Context.LaunchReporter.FinishTask.Wait();

                    Console.WriteLine($"Elapsed: {sw.Elapsed}");

                    try
                    {
                        if (AfterRunFinished != null)
                        {
                            AfterRunFinished(this, new RunFinishedEventArgs(Bridge.Service, finishLaunchRequest, Bridge.Context.LaunchReporter));
                        }
                    }
                    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);
            }
        }
 public void runFinished(object sender, RunFinishedEventArgs args)
 {
     Debug.WriteLine("Run Finished");
     Console.WriteLine("Exporting results to Testlink.");
     foreach (TestStepRun run in args.Report.TestPackageRun.AllTestStepRuns)
     {
         if (run.Step.IsTestCase)
         {
             exporter.ReportResult(run);
             //Console.Write(".");
         }
     }
     Console.WriteLine();;
     Console.WriteLine("Finished exporting results to Testlink");
     Console.WriteLine();
 }
Exemplo n.º 8
0
 internal static void OnAfterRunFinished(object sender, RunFinishedEventArgs eventArg)
 {
     AfterRunFinished?.Invoke(sender, eventArg);
 }