Ejemplo n.º 1
0
        private void CommandsSource_OnEndLogScopeCommand(Shared.Execution.ILogContext logContext, Shared.Extensibility.Commands.CommandArgs.LogScopeCommandArgs args)
        {
            var logScope = args.LogScope;

            var finishRequest = new FinishTestItemRequest
            {
                EndTime = logScope.EndTime.Value,
                Status  = _nestedStepStatusMap[logScope.Status]
            };

            if (ReportPortalAddin.LogScopes.ContainsKey(logScope.Id))
            {
                ReportPortalAddin.LogScopes[logScope.Id].Finish(finishRequest);
                ReportPortalAddin.LogScopes.TryRemove(logScope.Id, out ITestReporter _);
            }
            else
            {
                _traceLogger.Warn($"Unknown current step context to end log scope with `{logScope.Id}` ID.");
            }
        }
Ejemplo n.º 2
0
        private void CommandsSource_OnBeginLogScopeCommand(Shared.Execution.ILogContext logContext, Shared.Extensibility.Commands.CommandArgs.LogScopeCommandArgs args)
        {
            var logScope = args.LogScope;

            if (_outputHelperMap.TryGetValue(Context.Current.Log.Root, out ITestOutputHelper output))
            {
                var communicationMessage = new BeginScopeCommunicationMessage
                {
                    Id            = logScope.Id,
                    ParentScopeId = logScope.Parent?.Id,
                    Name          = logScope.Name,
                    BeginTime     = logScope.BeginTime
                };

                NotifyAgent(output, Client.Converters.ModelSerializer.Serialize <BeginScopeCommunicationMessage>(communicationMessage));
            }
        }
Ejemplo n.º 3
0
        private void CommandsSource_OnBeginLogScopeCommand(Shared.Execution.ILogContext logContext, Shared.Extensibility.Commands.CommandArgs.LogScopeCommandArgs args)
        {
            var logScope = args.LogScope;

            var startRequest = new StartTestItemRequest
            {
                Name      = logScope.Name,
                StartTime = logScope.BeginTime,
                HasStats  = false
            };

            ITestReporter testReporter = null;

            if (logScope.Parent != null)
            {
                if (ReportPortalAddin.LogScopes.ContainsKey(logScope.Parent.Id))
                {
                    testReporter = ReportPortalAddin.LogScopes[logScope.Parent.Id];
                }
            }
            else
            {
                testReporter = GetCurrentTestReporter();
            }

            if (testReporter != null)
            {
                var nestedStep = testReporter.StartChildTestReporter(startRequest);
                ReportPortalAddin.LogScopes[logScope.Id] = nestedStep;
            }
            else
            {
                _traceLogger.Warn("Unknown current step context to begin new log scope.");
            }
        }
Ejemplo n.º 4
0
        private void CommandsSource_OnEndLogScopeCommand(Shared.Execution.ILogContext logContext, Shared.Extensibility.Commands.CommandArgs.LogScopeCommandArgs args)
        {
            var logScope = args.LogScope;

            if (_outputHelperMap.TryGetValue(Context.Current.Log.Root, out ITestOutputHelper output))
            {
                var communicationMessage = new EndScopeCommunicationMessage
                {
                    Id      = logScope.Id,
                    EndTime = logScope.EndTime.Value,
                    Status  = logScope.Status
                };

                NotifyAgent(output, Client.Converters.ModelSerializer.Serialize <EndScopeCommunicationMessage>(communicationMessage));
            }
        }