Skip to content

Commit 2bda712

Browse files
committed
Test runner: More helpful output on failing test
1 parent 465fd43 commit 2bda712

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

netmockery/Controllers/TestsController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override void WriteResponse(string s)
3434
response.Append(s);
3535
}
3636

37-
public override void WriteResult(NetmockeryTestCaseResult result)
37+
public override void WriteResult(int index, NetmockeryTestCase testCase, NetmockeryTestCaseResult result)
3838
{
3939
response.AppendLine(result.ResultAsString);
4040
}

netmockery/TestRunner.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public NetmockeryTestCaseResult ExecuteTestAndOutputResult(int index, Netmockery
115115
WriteBeginTest(index, test);
116116

117117
var result = Url != null ? test.ExecuteAgainstUrlAsync(Url).Result : test.Execute(endpointCollection, now: now);
118-
WriteResult(result);
118+
WriteResult(index, test, result);
119119

120120
responsesCoveredByTests.Add(Tuple.Create(result.EndpointName, result.ResponseIndex));
121121

@@ -164,7 +164,7 @@ public CoverageInfo GetCoverageInfo()
164164

165165

166166
public abstract void WriteBeginTest(int index, NetmockeryTestCase testcase);
167-
public abstract void WriteResult(NetmockeryTestCaseResult result);
167+
public abstract void WriteResult(int index, NetmockeryTestCase testcase, NetmockeryTestCaseResult result);
168168
public abstract void WriteResponse(string response);
169169
public abstract void WriteSummary(int errors);
170170
public abstract void WriteError(string s);
@@ -200,9 +200,13 @@ public override void WriteResponse(string response)
200200

201201
}
202202

203-
public override void WriteResult(NetmockeryTestCaseResult result)
203+
public override void WriteResult(int index, NetmockeryTestCase netmockeryTestCase, NetmockeryTestCaseResult result)
204204
{
205205
Console.WriteLine(result.ResultAsString);
206+
if (result.Error)
207+
{
208+
Console.WriteLine($"FAILURE test case {index} {netmockeryTestCase.Name}");
209+
}
206210
}
207211

208212
public override void WriteSummary(int errors)

0 commit comments

Comments
 (0)