private static void AssertStepName(IStepResult step, string stepTypeName, string nameFormat, params StepParameterExpectation[] expectedParameters) { Assert.That(step.StepName, Is.Not.Null); Assert.That(step.StepName.NameFormat, Is.EqualTo(nameFormat)); Assert.That(step.StepName.StepTypeName, Is.EqualTo(stepTypeName)); AssertStepParameters(step.StepName.Parameters, expectedParameters); }
private static XElement ToXElement(IStepResult step) { var objects = new List <object> { new XAttribute("Status", step.Status.ToString()), new XAttribute("Number", step.Number), new XAttribute("Name", step.Name) }; if (step.ExecutionStart != null) { objects.Add(new XAttribute("ExecutionStart", step.ExecutionStart)); } if (step.ExecutionTime != null) { objects.Add(new XAttribute("ExecutionTime", step.ExecutionTime)); } if (step.StatusDetails != null) { objects.Add(new XElement("StatusDetails", step.StatusDetails)); } objects.Add(ToXElement(step.StepName)); objects.Add(step.Comments.Select(c => new XElement("Comment", c)).Cast <object>().ToArray()); return(new XElement("Step", objects)); }
private static IHtmlNode GetStep(IStepResult step) { return(Html.Tag(HtmlTextWriterTag.Div).Class("step").Content( GetStatus(step.Status), Html.Text(string.Format("{0}. {1}", step.Number, step.StepName.Format(_stepNameDecorator))).Trim(), GetDuration(step.ExecutionTime))); }
private static void FormatStep(TextWriter writer, IStepResult step, StringBuilder commentBuilder, int indent = 0) { var stepIndent = new string('\t', indent + 2); writer.Write(stepIndent); writer.Write("Step "); writer.Write(step.Info.GroupPrefix); writer.Write(step.Info.Number); writer.Write(": "); writer.Write(step.Info.Name); writer.Write(" - "); writer.Write(step.Status); if (step.ExecutionTime != null) { writer.Write(" ("); writer.Write(step.ExecutionTime.Duration.FormatPretty()); writer.Write(")"); } writer.WriteLine(); foreach (var parameterResult in step.Parameters) { FormatParameter(writer, parameterResult, stepIndent); } CollectComments(step, commentBuilder); foreach (var subStep in step.GetSubSteps()) { FormatStep(writer, subStep, commentBuilder, indent + 1); } }
/// <summary> /// Notifies that step has finished. /// </summary> /// <param name="step">Step result.</param> public void NotifyStepFinished(IStepResult step) { foreach (var notifier in _notifiers) { notifier.NotifyStepFinished(step); } }
private static XElement ToXElement(IStepResult step, string elementName) { var objects = new List <object> { new XAttribute("Status", step.Status.ToString()), new XAttribute("Number", step.Info.Number), new XAttribute("Name", step.Info.Name) }; if (step.ExecutionTime != null) { objects.Add(new XAttribute("ExecutionStart", step.ExecutionTime.Start)); objects.Add(new XAttribute("ExecutionTime", step.ExecutionTime.Duration)); } if (!string.IsNullOrEmpty(step.Info.GroupPrefix)) { objects.Add(new XAttribute("GroupPrefix", step.Info.GroupPrefix)); } if (step.StatusDetails != null) { objects.Add(new XElement("StatusDetails", step.StatusDetails)); } objects.Add(ToXElement(step.Info.Name)); objects.AddRange(step.Parameters.Select(ToXElement)); objects.AddRange(step.Comments.Select(c => new XElement("Comment", c))); objects.AddRange(step.GetSubSteps().Select(s => ToXElement(s, "SubStep"))); return(new XElement(elementName, objects)); }
/// <summary> /// Notifies that step execution has been finished. /// </summary> /// <param name="stepResult">Step result.</param> /// <param name="totalStepCount">Total step count</param> public void NotifyStepFinished(IStepResult stepResult, int totalStepCount) { foreach (var notifier in Notifiers) { notifier.NotifyStepFinished(stepResult, totalStepCount); } }
private XElement ToXElement(IStepResult step) { return(new XElement("Step", new XAttribute("Status", step.Status.ToString()), new XAttribute("Number", step.Number), new XAttribute("Name", step.Name))); }
private static IHtmlNode GetStep(IStepResult step) { return(Html.Tag(Html5Tag.Div).Class("step").Content( GetStatus(step.Status), Html.Text(string.Format("{0}{1}. {2}", step.Info.GroupPrefix, step.Info.Number, step.Info.Name.Format(StepNameDecorator))).Trim(), GetDuration(step.ExecutionTime), Html.Tag(Html5Tag.Div).Class("sub-steps").Content(step.GetSubSteps().Select(GetStep)).SkipEmpty())); }
private static IHtmlNode GetStep(IStepResult step) { return(Html.Tag(Html5Tag.Div).Class("step").Content( GetStatus(step.Status), Html.Text($"{WebUtility.HtmlEncode(step.Info.GroupPrefix)}{step.Info.Number}. {step.Info.Name.Format(StepNameDecorator)}").Trim(), GetDuration(step.ExecutionTime), Html.Tag(Html5Tag.Div).Class("step-parameters").Content(step.Parameters.Select(GetStepParameter)).SkipEmpty(), Html.Tag(Html5Tag.Div).Class("sub-steps").Content(step.GetSubSteps().Select(GetStep)).SkipEmpty())); }
private static void CollectComments(IStepResult step, StringBuilder commentBuilder) { foreach (var comment in step.Comments) { commentBuilder.Append("\t\t\tStep ").Append(step.Info.GroupPrefix).Append(step.Info.Number) .Append(": ") .AppendLine(comment.Replace(Environment.NewLine, Environment.NewLine + "\t\t\t\t")); } }
private void WriteStep(HtmlTextWriter writer, IStepResult step) { WriteTag(writer, HtmlTextWriterTag.Div, "step", () => { WriteStatus(writer, step.Status); WriteTag(writer, HtmlTextWriterTag.Span, "number", string.Format("{0}.", step.Number)); writer.Write(step.Name); }); }
private static void CollectComments(IStepResult step, StringBuilder commentBuilder) { foreach (var comment in step.Comments) { commentBuilder.Append("\t\t\tStep ") .Append(step.Number) .Append(": ") .AppendLine(comment.Replace(Environment.NewLine, Environment.NewLine + "\t\t\t\t")); } }
private static void FormatStep(StringBuilder builder, IStepResult step) { builder.Append("\t\tStep ") .Append(step.Number).Append(": ") .Append(step.Name).Append(" - ").Append(step.Status); if (step.ExecutionTime != null) { builder.Append(" (").Append(step.ExecutionTime.FormatPretty()).Append(")"); } builder.AppendLine(); }
private static void FormatStep(TextWriter writer, IStepResult step) { writer.Write("\t\tStep "); writer.Write(step.Info.Number); writer.Write(": "); writer.Write(step.Info.Name); writer.Write(" - "); writer.Write(step.Status); if (step.ExecutionTime != null) { writer.Write(" ("); writer.Write(step.ExecutionTime.Duration.FormatPretty()); writer.Write(")"); } writer.WriteLine(); }
/// <summary> /// Notifies that step has finished. /// </summary> /// <param name="step">Step result.</param> public void NotifyStepFinished(IStepResult step) { var report = new List <string> { $" STEP {step.Info.GroupPrefix}{step.Info.Number}/{step.Info.GroupPrefix}{step.Info.Total}: {step.Info.Name} ({step.Status} after {step.ExecutionTime.Duration.FormatPretty()})" }; foreach (var parameter in step.Parameters) { if (parameter.Details is ITabularParameterDetails table) { report.Add($" {parameter.Name}:"); report.Add(new TextTableRenderer(table).Render(" ")); } } _onNotify(string.Join(Environment.NewLine, report)); }
public string WriteSubSteps(IStepResult step, string prefixStep) { var subSteps = step.GetSubSteps(); if ((subSteps?.Count() ?? 0) == 0) { return(null); } StringBuilder sb = new StringBuilder(); foreach (var subStep in subSteps) { string comments = string.Join(";<br />", step.Comments); sb.AppendLine($"|{prefixStep}{subStep.Info.Number}|{subStep.Info.Name}|{subStep.Status}|{comments}|"); } return(sb.ToString()); }
public void NotifyStepFinished(IStepResult step) { _notifications.Add($"Step Finish: {FormatStep(step.Info)} | Status:{step.Status} | ExecutionTimePresent:{step.ExecutionTime != null} | Details:{step.StatusDetails}"); }
private static IHtmlNode GetStep(IStepResult step) { return Html.Tag(HtmlTextWriterTag.Div).Class("step").Content( GetStatus(step.Status), Html.Text(string.Format("{0}. {1}", step.Number, step.StepName.Format(_stepNameDecorator))).Trim(), GetDuration(step.ExecutionTime)); }
/// <summary> /// Returns enumeration over step-sub step hierarchy, including specified step. /// </summary> public static IEnumerable <IStepResult> GetAllSteps(this IStepResult step) { return(Enumerable.Repeat(step, 1).Concat(step.GetSubSteps().SelectMany(s => s.GetAllSteps()))); }
public static IStepResult WithExecutionTime(this IStepResult result, TimeSpan executionTime) { result.Stub(r => r.ExecutionTime).Return(executionTime); return(result); }
/// <summary> /// Notifies that step execution has been finished. /// </summary> /// <param name="stepResult">Step result.</param> /// <param name="totalStepCount">Total step count</param> public void NotifyStepFinished(IStepResult stepResult, int totalStepCount) { }
public void NotifyStepFinished(IStepResult step) { _notifier.NotifyStepFinished(step); }
public static IStepResult WithTimes(this IStepResult result, DateTimeOffset executionStart, TimeSpan executionTime) { return(result.WithExecutionStart(executionStart) .WithExecutionTime(executionTime)); }
/// <summary> /// Notifies that step execution has been finished. /// </summary> /// <param name="stepResult">Step result.</param> /// <param name="totalStepCount">Total step count</param> public void NotifyStepFinished(IStepResult stepResult, int totalStepCount) { WriteLine(" STEP {0}/{1}: {2} ({3} after {4})", stepResult.Number, totalStepCount, stepResult.Name, stepResult.Status, stepResult.ExecutionTime.FormatPretty()); }
/// <summary> /// Notifies that step has finished. /// </summary> /// <param name="step">Step result.</param> public void NotifyStepFinished(IStepResult step) { _onNotify($" STEP {step.Info.GroupPrefix}{step.Info.Number}/{step.Info.GroupPrefix}{step.Info.Total}: {step.Info.Name} ({step.Status} after {step.ExecutionTime.Duration.FormatPretty()})"); }
public void NotifyStepFinished(IStepResult step) { }
private static XElement ToXElement(IStepResult step) { var objects = new List<object> { new XAttribute("Status", step.Status.ToString()), new XAttribute("Number", step.Number), new XAttribute("Name", step.Name) }; if (step.ExecutionStart != null) objects.Add(new XAttribute("ExecutionStart", step.ExecutionStart)); if (step.ExecutionTime != null) objects.Add(new XAttribute("ExecutionTime", step.ExecutionTime)); if (step.StatusDetails != null) objects.Add(new XElement("StatusDetails", step.StatusDetails)); objects.Add(ToXElement(step.StepName)); objects.Add(step.Comments.Select(c => new XElement("Comment", c)).Cast<object>().ToArray()); return new XElement("Step", objects); }
public static IStepResult WithExecutionStart(this IStepResult result, DateTimeOffset executionStart) { result.Stub(r => r.ExecutionStart).Return(executionStart); return(result); }
/// <summary> /// Notifies that step execution has been finished. /// </summary> /// <param name="stepResult">Step result.</param> /// <param name="totalStepCount">Total step count</param> public void NotifyStepFinished(IStepResult stepResult, int totalStepCount) { foreach (var notifier in Notifiers) notifier.NotifyStepFinished(stepResult, totalStepCount); }
public static IStepResult WithDetails(this IStepResult result, string statusDetails) { result.Stub(r => r.StatusDetails).Return(statusDetails); return(result); }
public void NotifyStepFinished(IStepResult stepResult, int totalStepCount) { }
public static IStepResult WithStepNameDetails(this IStepResult result, string stepName, string nameFormat, string stepTypeName = null, params string[] parameters) { result.Stub(r => r.StepName).Return(CreateStepName(stepName, stepTypeName, nameFormat, parameters)); result.Stub(r => r.Name).Return(stepName); return(result); }
public static IStepResult WithComments(this IStepResult result, params string[] comments) { result.Stub(r => r.Comments).Return(comments); return(result); }
private static void FormatStep(StringBuilder builder, IStepResult step) { builder.Append("\t\tStep ") .Append(step.Number).Append(": ") .Append(step.Name).Append(" - ").Append(step.Status); if (step.ExecutionTime != null) builder.Append(" (").Append(step.ExecutionTime.FormatPretty()).Append(")"); builder.AppendLine(); }