Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ body{margin:0;padding:0;padding-bottom:40px;max-width:100%;background-color:#fff
<li class='step Failed Assertion canToggle' data-toggle-target='step-1-1' >
<span>Then no money is dispensed [Exception Message: 'Boom']</span>
<div class='step FailedException' id='step-1-1'>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs:line 89</code>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs</code>
</div>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ body{margin:0;padding:0;padding-bottom:40px;max-width:100%;background-color:#fff
With
New lines</span>
<div class='step' id='step-1-1'>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs:line 112</code>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs</code>
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abb
<span>When the account holder requests money</span>
</li>
<li class='step Failed Assertion canToggle' data-toggle-target='step-1-1' >
<span>Then no money is dispensed [Exception Message: 'This is a test exception.']</span>
<span>Then no money is dispensed [Exception Message: 'Boom']</span>
<div class='step FailedException' id='step-1-1'>
<code>This is a test stack trace</code>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetOneOfEachScenarioResult() in ...\ReportTestData.cs</code>
</div>
</li>
</ul>
Expand Down Expand Up @@ -214,9 +214,9 @@ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abb
<span>When the account holder requests money</span>
</li>
<li class='step Failed Assertion canToggle' data-toggle-target='step-1-1' >
<span>Then no money is dispensed [Exception Message: 'This is a test exception.']</span>
<span>Then no money is dispensed [Exception Message: 'Boom']</span>
<div class='step FailedException' id='step-1-1'>
<code>This is a test stack trace</code>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetOneOfEachScenarioResult() in ...\ReportTestData.cs</code>
</div>
</li>
</ul>
Expand Down Expand Up @@ -282,9 +282,9 @@ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abb
<span>When the account holder requests money</span>
</li>
<li class='step Failed Assertion canToggle' data-toggle-target='step-1-1' >
<span>Then no money is dispensed [Exception Message: 'This is a test exception.']</span>
<span>Then no money is dispensed [Exception Message: 'Boom']</span>
<div class='step FailedException' id='step-1-1'>
<code>This is a test stack trace</code>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetOneOfEachScenarioResult() in ...\ReportTestData.cs</code>
</div>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abb
With
New lines</span>
<div class='step FailedException' id='step-1-1'>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs:line 112</code>
<code> at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs</code>
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#### Exceptions:
1. Boom With New lines
at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs:line 112
at TestStack.BDDfy.Tests.Reporters.ReportTestData.GetScenarios(Boolean includeFailingScenario, Boolean includeExamples) in ...\ReportTestData.cs

## Story: Happiness
**As a person**
Expand Down
2 changes: 1 addition & 1 deletion TestStack.BDDfy.Tests/Reporters/ReportApprover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void Approve(Func<FileReportModel> model, IReportBuilder reportBui
using (new TemporaryCulture("en-GB"))
{
var result = reportBuilder.CreateReport(model());
Approvals.Verify(result, s => Scrub(StackTraceScrubber.ScrubPaths(s)));
Approvals.Verify(result, s => Scrub(StackTraceScrubber.ScrubLineNumbers(StackTraceScrubber.ScrubPaths(s))));
}
}

Expand Down
24 changes: 10 additions & 14 deletions TestStack.BDDfy.Tests/Reporters/ReportTestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,16 @@ private Scenario[] GetOneOfEachScenarioResult()
SetAllStepResults(scenarios[0].Steps, Result.Passed);

SetAllStepResults(scenarios[1].Steps, Result.Passed);
scenarios[1].Steps.Last().Result = Result.Failed;
scenarios[1].Steps.Last().Exception = new FakeExceptionWithStackTrace("This is a test exception.");
var last = scenarios[1].Steps.Last();
last.Result = Result.Failed;
try
{
throw new InvalidOperationException("Boom");
}
catch (Exception ex)
{
last.Exception = ex;
}

return scenarios.ToArray();
}
Expand Down Expand Up @@ -270,17 +278,5 @@ public void GivenANegativeAccountBalance() { }
public void WhenTheAccountHolderRequestsMoney() { }
public void ThenNoMoneyIsDispensed() { }
}

class FakeExceptionWithStackTrace : Exception
{
public FakeExceptionWithStackTrace(string message)
: base(message)
{ }

public override string StackTrace
{
get { return "This is a test stack trace"; }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public string CreateReport(FileReportModel model)
{
report.AppendLine(string.Format("### {0}", scenario.Title));

foreach (var step in scenario.Steps)
foreach (var step in scenario.Steps.Where(s => s.ShouldReport))
report.AppendLine(" " + HttpUtility.HtmlEncode(step.Title) + " ");

report.AppendLine(); // separator
Expand Down