Skip to content

Commit

Permalink
Test runner: More helpful output on failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
codeape2 committed Feb 10, 2017
1 parent 465fd43 commit 2bda712
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion netmockery/Controllers/TestsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void WriteResponse(string s)
response.Append(s);
}

public override void WriteResult(NetmockeryTestCaseResult result)
public override void WriteResult(int index, NetmockeryTestCase testCase, NetmockeryTestCaseResult result)
{
response.AppendLine(result.ResultAsString);
}
Expand Down
10 changes: 7 additions & 3 deletions netmockery/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public NetmockeryTestCaseResult ExecuteTestAndOutputResult(int index, Netmockery
WriteBeginTest(index, test);

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

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

Expand Down Expand Up @@ -164,7 +164,7 @@ public CoverageInfo GetCoverageInfo()


public abstract void WriteBeginTest(int index, NetmockeryTestCase testcase);
public abstract void WriteResult(NetmockeryTestCaseResult result);
public abstract void WriteResult(int index, NetmockeryTestCase testcase, NetmockeryTestCaseResult result);
public abstract void WriteResponse(string response);
public abstract void WriteSummary(int errors);
public abstract void WriteError(string s);
Expand Down Expand Up @@ -200,9 +200,13 @@ public override void WriteResponse(string response)

}

public override void WriteResult(NetmockeryTestCaseResult result)
public override void WriteResult(int index, NetmockeryTestCase netmockeryTestCase, NetmockeryTestCaseResult result)
{
Console.WriteLine(result.ResultAsString);
if (result.Error)
{
Console.WriteLine($"FAILURE test case {index} {netmockeryTestCase.Name}");
}
}

public override void WriteSummary(int errors)
Expand Down

0 comments on commit 2bda712

Please sign in to comment.