@using System.Linq @using System.Globalization @using TechTalk.SpecRun.Framework @using TechTalk.SpecRun.Framework.Results @using TechTalk.SpecRun.Framework.TestSuiteStructure @helper GetReportBar(TestItemExecutionResult test) {   } @helper GetTimelineBar(DateTime startTime, DateTime endTime, double msecPerPixel, TestItemExecutionResult test) { int endPixel = Math.Max((int)Math.Round((endTime - Model.ExecutionTime.StartTime).TotalMilliseconds / msecPerPixel), currentPixel + 4); int size = endPixel - currentPixel; currentPixel = endPixel;   } @helper GetSummaryHeader(string titleHeader) { @if (titleHeader != null) { @titleHeader } Success rate Tests Succeeded Failed Pending Ignored Skipped } @helper GetSummaryRow(TestCollectionResultSummary summary, string title, string href) { @if (title != null) { @title } @GetSummaryRowTail(summary) } @helper GetSummaryRowTail(TestCollectionResultSummary summary) { @if(summary.TotalSucceeded + summary.TotalFailure + summary.TotalPending > 0) { @:@Math.Round((double)summary.TotalSucceeded * 100 / (summary.TotalSucceeded + summary.TotalFailure + summary.TotalPending))% } else { @:n/a } @foreach (var resultCount in summary.ResultCounts.Where(rc => rc.Value > 0).OrderByDescending(rc => rc.Key.GetGroup() == TestNodeResultTypeGroup.Success ? 1000 : (int)rc.Key)) { }
@summary.TotalMessage @summary.Succeeded @summary.TotalFailure @summary.TotalPending @summary.Ignored @summary.Skipped } @helper TestItemLinks(TestItem testItem, int level) { if (level == 0) { @testItem.Type: @testItem.Title } else { @testItem.Title } var tiResult = GetTestItemResult(testItem); if (tiResult != null) { foreach (var retry in tiResult.Executions.Skip(1)) { retry #@retry.TestItemExecutionIndex } } } @helper TestNodeLinks(TestNode testNode, int level) { @if (testNode is TestItem) { @TestItemLinks((TestItem)testNode, level) } @if (testNode is TestCollection) { @testNode.Type: @testNode.Title } } @functions { string GetFixtureTitle(TestNode fixtureNode) { return fixtureNode.IsDefaultTestTarget ? fixtureNode.Title : string.Format("{0} (target: {1})", fixtureNode.Title, fixtureNode.TestTarget); } } @Model.Configuration.ProjectName Test Execution Report

@Model.Configuration.ProjectName Test Execution Report

Result: @Model.Summary.ConcludedResultMessage

@GetSummaryHeader(null) @GetSummaryRow(Model.Summary, null, null)

Test Timeline Summary

@{ double msecPerPixel = Model.ExecutionTime.DurationMilliseconds / (Model.TestExecutionResults.Count() * 7); var secScale = Math.Max(1.0, Math.Round((msecPerPixel / 1000 * 70) / 2) * 2); var scaleItemCount = (int)Math.Floor(Model.ExecutionTime.DurationSeconds / secScale) + 1; var pixelScale = secScale * 1000 / msecPerPixel; }
@foreach (var testThread in Model.TestThreads) { } @for (int scaleIndex = 0; scaleIndex < scaleItemCount - 1; scaleIndex++) { var width = (int)(Math.Round((scaleIndex + 1) * pixelScale) - Math.Round((scaleIndex) * pixelScale)); }
thread
#@testThread.ThreadId @{ currentPixel = 0; } @GetTimelineBar(Model.ExecutionTime.StartTime, testThread.ExecutionTime.StartTime, msecPerPixel, null) @foreach (var test in Model.TestExecutionResults.Where(tr => tr.ThreadId == testThread.ThreadId).OrderBy(tr => tr.ExecutionOrder)) { @GetTimelineBar(test.ExecutionTime.StartTime, test.ExecutionTime.EndTime, msecPerPixel, test) }
 @Math.Round(secScale * scaleIndex)s@Math.Round(secScale * (scaleItemCount - 1))s

Test Result View

Time Act Time Execution Result desc
Time Act Time @*Result *@
     
     
     
@foreach (var test in Model.TestExecutionResults.OrderBy(tr => tr.ResultType)) { @GetReportBar(test); } @for (int test10Index = 1; test10Index < Model.TestExecutionResults.Count() / 10; test10Index++) { }
  
   @(test10Index * 10)

Feature Summary

@GetSummaryHeader("Feature") @foreach (var fixtureNode in GetTextFixtures()) { var fixtureSummary = GetSummary(fixtureNode); @GetSummaryRow(fixtureSummary, GetFixtureTitle(fixtureNode), GetTestNodeAnchor(fixtureNode, "f")) }

Error Summary

@GetSummaryHeader("Test") @foreach (var testResult in Model.Tests.Where(tr => tr.Result.GetGroup() == TestNodeResultTypeGroup.Failure)) { var testSummary = GetSummary(testResult.TestNode); @GetSummaryRowTail(testSummary) @if (!string.IsNullOrEmpty(testResult.Error)) { } }
@GetTestTitle(testResult) @foreach (var retry in testResult.Executions.Skip(1)) { retry #@retry.TestItemExecutionIndex }
Error: @HttpEncode(testResult.Error)

Scenario Summary

@foreach (var fixtureNode in GetTextFixtures()) {

@fixtureNode.Type: @GetFixtureTitle(fixtureNode)

@if (!string.IsNullOrEmpty(fixtureNode.Description)) {
@fixtureNode.Description
} @GetSummaryHeader("Test") @foreach (var testNode in fixtureNode.SubNodes) { var testSummary = GetSummary(testNode); @GetSummaryRowTail(testSummary) }
@TestNodeLinks(testNode, 0)
}

Execution Details

@foreach (var test in Model.TestExecutionResults.OrderBy(tr => tr.ExecutionOrder)) { var testItem = test.TestItemResult.TestNode;

@testItem.Type: @GetTestTitle(test)

@if (!string.IsNullOrEmpty(testItem.Description)) {
@testItem.Description
} if (testItem.Tags.Any()) {
tags: @string.Join(", ", testItem.Tags)
} @foreach (var traceEvent in test.Result.TraceEvents) { if (!IsRelevant(traceEvent)) continue; var relatedNode = GetTestNode(traceEvent); }
Steps Trace Result
@HttpEncode(traceEvent.BusinessMessages.TrimEnd())
@FormatTechMessages(traceEvent.TechMessages.TrimEnd())
@if (!string.IsNullOrEmpty(traceEvent.Error)) {
@FormatTechMessages(traceEvent.Error)
@FormatTechMessages(traceEvent.StackTrace.TrimEnd())
}
@traceEvent.ResultType in @GetSeconds(Math.Round(traceEvent.Duration.TotalSeconds, 3))s
}