public static void AfterFeature(FeatureContext featureContext) { lock (LockHelper.GetLock(FeatureInfoEqualityComparer.GetFeatureInfoHashCode(featureContext.FeatureInfo))) { var currentFeature = ReportPortalAddin.GetFeatureTestReporter(featureContext); var remainingThreadCount = ReportPortalAddin.DecrementFeatureThreadCount(featureContext); if (currentFeature != null && currentFeature.FinishTask == null && remainingThreadCount == 0) { var request = new FinishTestItemRequest { EndTime = DateTime.UtcNow, Status = Status.Skipped }; var eventArg = new TestItemFinishedEventArgs(Bridge.Service, request, currentFeature); ReportPortalAddin.OnBeforeFeatureFinished(null, eventArg); if (!eventArg.Canceled) { currentFeature.Finish(request); currentFeature.FinishTask.Wait(); ReportPortalAddin.OnAfterFeatureFinished(null, new TestItemFinishedEventArgs(Bridge.Service, request, currentFeature)); } } } }
public static void BeforeFeature(FeatureContext featureContext) { try { if (_launchReporter != null) { ContextAwareLogHandler.ActiveFeatureContext = featureContext; lock (LockHelper.GetLock(FeatureInfoEqualityComparer.GetFeatureInfoHashCode(featureContext.FeatureInfo))) { var currentFeature = ReportPortalAddin.GetFeatureTestReporter(featureContext); if (currentFeature == null || currentFeature.FinishTask != null) { var request = new StartTestItemRequest { Name = featureContext.FeatureInfo.Title, Description = featureContext.FeatureInfo.Description, StartTime = DateTime.UtcNow, Type = TestItemType.Suite, Attributes = featureContext.FeatureInfo.Tags?.Select(t => new ItemAttributeConverter().ConvertFrom(t, (opts) => opts.UndefinedKey = "Tag")).ToList() }; var eventArg = new TestItemStartedEventArgs(_service, request, null, featureContext, null); ReportPortalAddin.OnBeforeFeatureStarted(null, eventArg); if (!eventArg.Canceled) { currentFeature = _launchReporter.StartChildTestReporter(request); ReportPortalAddin.SetFeatureTestReporter(featureContext, currentFeature); ReportPortalAddin.OnAfterFeatureStarted(null, new TestItemStartedEventArgs(_service, request, currentFeature, featureContext, null)); } } else { ReportPortalAddin.IncrementFeatureThreadCount(featureContext); } } } } catch (Exception exp) { _traceLogger.Error(exp.ToString()); } }
public static void AfterFeature(FeatureContext featureContext) { try { lock (LockHelper.GetLock(FeatureInfoEqualityComparer.GetFeatureInfoHashCode(featureContext.FeatureInfo))) { var currentFeature = ReportPortalAddin.GetFeatureTestReporter(featureContext); var remainingThreadCount = ReportPortalAddin.DecrementFeatureThreadCount(featureContext); if (currentFeature != null && currentFeature.FinishTask == null && remainingThreadCount == 0) { var request = new FinishTestItemRequest { EndTime = DateTime.UtcNow, Status = Status.Skipped }; var eventArg = new TestItemFinishedEventArgs(_service, request, currentFeature, featureContext, null); ReportPortalAddin.OnBeforeFeatureFinished(null, eventArg); if (!eventArg.Canceled) { currentFeature.Finish(request); ReportPortalAddin.OnAfterFeatureFinished(null, new TestItemFinishedEventArgs(_service, request, currentFeature, featureContext, null)); } ReportPortalAddin.RemoveFeatureTestReporter(featureContext, currentFeature); } } } catch (Exception exp) { _traceLogger.Error(exp.ToString()); } finally { ContextAwareLogHandler.ActiveFeatureContext = null; } }
public static void BeforeFeature(FeatureContext featureContext) { if (Bridge.Context.LaunchReporter != null) { lock (LockHelper.GetLock(FeatureInfoEqualityComparer.GetFeatureInfoHashCode(featureContext.FeatureInfo))) { var currentFeature = ReportPortalAddin.GetFeatureTestReporter(featureContext); if (currentFeature == null || currentFeature.FinishTask != null) { var request = new StartTestItemRequest { Name = featureContext.FeatureInfo.Title, Description = featureContext.FeatureInfo.Description, StartTime = DateTime.UtcNow, Type = TestItemType.Suite, Tags = new List <string>(featureContext.FeatureInfo.Tags) }; var eventArg = new TestItemStartedEventArgs(Bridge.Service, request); ReportPortalAddin.OnBeforeFeatureStarted(null, eventArg); if (!eventArg.Canceled) { currentFeature = Bridge.Context.LaunchReporter.StartNewTestNode(request); ReportPortalAddin.SetFeatureTestReporter(featureContext, currentFeature); ReportPortalAddin.OnAfterFeatureStarted(null, new TestItemStartedEventArgs(Bridge.Service, request, currentFeature)); } } else { ReportPortalAddin.IncrementFeatureThreadCount(featureContext); } } } }