From c91e1c4238669cfa33a0bfde6c51df4902cefb1d Mon Sep 17 00:00:00 2001 From: Niall Crowe Date: Mon, 13 May 2024 15:04:11 +0100 Subject: [PATCH] UX update for list of failed tests (#87) The line "The following tests failed: " was appearing when there were no test failures. This update simply updates it to only display when there are failed tests. --- Turkey/TestOutputFormat.cs | 2 +- Turkey/TestRunner.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Turkey/TestOutputFormat.cs b/Turkey/TestOutputFormat.cs index e342307..4f85e64 100644 --- a/Turkey/TestOutputFormat.cs +++ b/Turkey/TestOutputFormat.cs @@ -67,7 +67,7 @@ public async override Task PrintFailedTests() Console.WriteLine("The following tests failed: "); foreach(var test in failedTests) { - Console.WriteLine($"{string.Format("{0,-30}", test.Name)}({test.Duration})"); + Console.WriteLine($"{string.Format("{0,-30}", test.Name)}({test.Duration})"); } } diff --git a/Turkey/TestRunner.cs b/Turkey/TestRunner.cs index 2c36624..13ce46b 100644 --- a/Turkey/TestRunner.cs +++ b/Turkey/TestRunner.cs @@ -152,7 +152,10 @@ public async Task ScanAndRunAsync(List outputs, string await outputs.ForEachAsync(output => output.AfterRunningTestAsync(testName, testResult, testLog, testTimeWatch.Elapsed)); } - await outputs.ForEachAsync(outputs => outputs.PrintFailedTests()); + if (results.Failed != 0 ) + { + await outputs.ForEachAsync(outputs => outputs.PrintFailedTests()); + } await outputs.ForEachAsync(output => output.AfterRunningAllTestsAsync(results));