Beispiel #1
0
        private BeforeLaunchFinishingEventArgs NotifyFinishing(FinishLaunchRequest request)
        {
            var args = new BeforeLaunchFinishingEventArgs(_service, _configuration, request);

            Notify(() => ReportEventsSource.RaiseBeforeLaunchFinishing(_reportEventsSource, this, args));
            return(args);
        }
Beispiel #2
0
        private AfterLaunchFinishedEventArgs NotifyFinished()
        {
            var args = new AfterLaunchFinishedEventArgs(_service, _configuration);

            Notify(() => ReportEventsSource.RaiseAfterLaunchFinished(_reportEventsSource, this, args));
            return(args);
        }
Beispiel #3
0
        private BeforeTestStartingEventArgs NotifyStarting(StartTestItemRequest request)
        {
            var args = new BeforeTestStartingEventArgs(_service, _configuration, request);

            Notify(() => ReportEventsSource.RaiseBeforeTestStarting(_reportEventsSource, this, args));
            return(args);
        }
Beispiel #4
0
 public TestReporter(IClientService service, IConfiguration configuration, ILaunchReporter launchReporter, ITestReporter parentTestReporter, IRequestExecuter requestExecuter, IExtensionManager extensionManager, ReportEventsSource reportEventNotifier)
 {
     _service            = service;
     _configuration      = configuration;
     _requestExecuter    = requestExecuter;
     _extensionManager   = extensionManager;
     _reportEventsSource = reportEventNotifier;
     LaunchReporter      = launchReporter;
     ParentTestReporter  = parentTestReporter;
 }
Beispiel #5
0
        public LaunchReporter(IClientService service, IConfiguration configuration, IRequestExecuter requestExecuter, IExtensionManager extensionManager)
        {
            _service = service;

            if (configuration != null)
            {
                _configuration = configuration;
            }
            else
            {
                var jsonPath = System.IO.Path.GetDirectoryName(new Uri(typeof(LaunchReporter).Assembly.CodeBase).LocalPath) + "/ReportPortal.config.json";
                _configuration = new ConfigurationBuilder().AddJsonFile(jsonPath).AddEnvironmentVariables().Build();
            }

            _requestExecuter = requestExecuter ?? new RequestExecuterFactory(_configuration).Create();

            _extensionManager = extensionManager ?? throw new ArgumentNullException(nameof(extensionManager));

            _reportEventsSource = new ReportEventsSource();
            if (extensionManager.ReportEventObservers != null)
            {
                foreach (var reportEventObserver in extensionManager.ReportEventObservers)
                {
                    try
                    {
                        reportEventObserver.Initialize(_reportEventsSource);
                    }
                    catch (Exception initExp)
                    {
                        TraceLogger.Error($"Unhandled exception while initializing of {reportEventObserver.GetType().FullName}: {initExp}");
                    }
                }
            }

            // identify whether launch is already started by any external system
            var externalLaunchUuid = _configuration.GetValue <string>("Launch:Id", null);

            if (externalLaunchUuid != null)
            {
                _isExternalLaunchId = true;

                _launchInfo = new LaunchInfo
                {
                    Uuid = externalLaunchUuid
                };
            }

            // identify whether launch should be rerun
            _rerunOfUuid = _configuration.GetValue <string>("Launch:RerunOf", null);

            _isRerun = _configuration.GetValue("Launch:Rerun", false);
        }
Beispiel #6
0
 public static void RaiseAfterTestFinished(ReportEventsSource source, ITestReporter testReporter, AfterTestFinishedEventArgs args)
 {
     source.OnAfterTestFinished?.Invoke(testReporter, args);
 }
Beispiel #7
0
 public static void RaiseBeforeTestFinishing(ReportEventsSource source, ITestReporter testReporter, BeforeTestFinishingEventArgs args)
 {
     source.OnBeforeTestFinishing?.Invoke(testReporter, args);
 }
Beispiel #8
0
 public static void RaiseAfterLaunchFinished(ReportEventsSource source, ILaunchReporter launchReporter, AfterLaunchFinishedEventArgs args)
 {
     source.OnAfterLaunchFinished?.Invoke(launchReporter, args);
 }
Beispiel #9
0
 public static void RaiseBeforeLaunchFinishing(ReportEventsSource source, ILaunchReporter launchReporter, BeforeLaunchFinishingEventArgs args)
 {
     source.OnBeforeLaunchFinishing?.Invoke(launchReporter, args);
 }