From 795d3a8e69a52fdc449e11116a974b240b1ba0ef Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 24 Sep 2019 13:00:05 +0530 Subject: [PATCH 01/28] added verbosity quiest --- src/vstest.console/Internal/ConsoleLogger.cs | 51 +++++++++++++++++-- .../Resources/Resources.Designer.cs | 18 +++++++ src/vstest.console/Resources/Resources.resx | 6 +++ .../Resources/xlf/Resources.cs.xlf | 10 ++++ .../Resources/xlf/Resources.de.xlf | 10 ++++ .../Resources/xlf/Resources.es.xlf | 10 ++++ .../Resources/xlf/Resources.fr.xlf | 10 ++++ .../Resources/xlf/Resources.it.xlf | 10 ++++ .../Resources/xlf/Resources.ja.xlf | 10 ++++ .../Resources/xlf/Resources.ko.xlf | 10 ++++ .../Resources/xlf/Resources.pl.xlf | 10 ++++ .../Resources/xlf/Resources.pt-BR.xlf | 10 ++++ .../Resources/xlf/Resources.ru.xlf | 10 ++++ .../Resources/xlf/Resources.tr.xlf | 10 ++++ .../Resources/xlf/Resources.xlf | 10 ++++ .../Resources/xlf/Resources.zh-Hans.xlf | 10 ++++ .../Resources/xlf/Resources.zh-Hant.xlf | 10 ++++ 17 files changed, 210 insertions(+), 5 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index de6e74da9b..50a7e11d30 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -4,6 +4,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal { using System; + using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; @@ -16,8 +17,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.Utilities; - using CommandLineResources = Resources.Resources; - + using CommandLineResources =Resources.Resources; /// /// Logger for sending output to the console. /// All the console logger messages prints to Standard Output with respective color, except OutputLevel.Error messages @@ -155,6 +155,17 @@ protected static IOutput Output /// public Verbosity VerbosityLevel => verbosityLevel; + public class Summary + { + public int Totaltests { get; set; } + public int Passedtests { get; set; } + public int Failedtests { get; set; } + public int Skippedtests { get; set; } + public TimeSpan timespan { get; set; } + } + + public ConcurrentDictionary SummaryDictionary { get; private set; } + #endregion #region ITestLoggerWithParameters @@ -181,7 +192,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Progress indicator needs to be displayed only for cli experience. this.progressIndicator = new ProgressIndicator(Output, new ConsoleHelper()); } - + // Register for the events. events.TestRunMessage += this.TestMessageHandler; events.TestResult += this.TestResultHandler; @@ -190,6 +201,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Register for the discovery events. events.DiscoveryMessage += this.TestMessageHandler; + SummaryDictionary = new ConcurrentDictionary(); // TODO Get changes from https://github.com/Microsoft/vstest/pull/1111/ // events.DiscoveredTests += DiscoveredTestsHandler; @@ -467,10 +479,17 @@ private void TestResultHandler(object sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); + SummaryDictionary.TryGetValue(e.Result.TestCase.Source, out var summary); + if (summary == null) + { + summary = new Summary(); + SummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); + } // Update the test count statistics based on the result of the test. this.testsTotal++; - + summary.Totaltests++; + summary.timespan += e.Result.EndTime - e.Result.StartTime; var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) @@ -489,6 +508,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Skipped: { this.testsSkipped++; + summary.Skippedtests++; if (this.verbosityLevel == Verbosity.Quiet) { break; @@ -513,11 +533,12 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Failed: { this.testsFailed++; + summary.Failedtests++; if (this.verbosityLevel == Verbosity.Quiet) { break; } - + // Pause the progress indicator before displaying test result information this.progressIndicator?.Pause(); @@ -534,6 +555,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Passed: { this.testsPassed++; + summary.Passedtests++; if (this.verbosityLevel == Verbosity.Normal || this.verbosityLevel == Verbosity.Detailed) { // Pause the progress indicator before displaying test result information @@ -621,6 +643,25 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) this.progressIndicator?.Stop(); Output.WriteLine(string.Empty, OutputLevel.Information); + if (verbosityLevel == Verbosity.Quiet) + { + foreach (var sd in SummaryDictionary.ToArray()) + { + var summary = SummaryDictionary[sd.Key]; + + // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) + if (summary.Failedtests > 0) + { + Output.Information(false, ConsoleColor.White, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.Passedtests,summary.Failedtests,summary.Skippedtests, GetFormattedDurationString(summary.timespan),sd.Key.Split('\\').Last())); + } + else + { + Output.Information(false, ConsoleColor.White, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed,summary.Totaltests, summary.Passedtests, summary.Failedtests, summary.Skippedtests, GetFormattedDurationString(summary.timespan), sd.Key.Split('\\').Last())); + } + } + return; + } + // Printing Run-level Attachments var runLevelAttachementCount = (e.AttachmentSets == null) ? 0 : e.AttachmentSets.Sum(attachmentSet => attachmentSet.Attachments.Count); if (runLevelAttachementCount > 0) diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 04393581bc..3b134e26df 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1550,6 +1550,15 @@ internal static string TestRunSuccessful { } } + /// + /// Looks up a localized string similar to Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4}. + /// + internal static string TestRunSummaryFailed { + get { + return ResourceManager.GetString("TestRunSummaryFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed: {0}. /// @@ -1568,6 +1577,15 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } } + /// + /// Looks up a localized string similar to Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5}. + /// + internal static string TestRunSummaryPassed { + get { + return ResourceManager.GetString("TestRunSummaryPassed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Passed: {0}. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 33cf76e005..6090249ead 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -734,4 +734,10 @@ A total of {0} test files matched the specified pattern. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index b1593f23ca..2303ceb367 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1656,6 +1656,16 @@ Celkový počet testovacích souborů, které odpovídají zadanému vzoru: {0} + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 20ab7d8d2d..cc0b72b8cc 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1656,6 +1656,16 @@ Insgesamt {0} Testdateien stimmten mit dem angegebenen Muster überein. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 1aa4e67d8c..a7fd505028 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1659,6 +1659,16 @@ {0} archivos de prueba en total coincidieron con el patrón especificado. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 0a608c7575..3d9925ee7d 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1656,6 +1656,16 @@ Au total, {0} fichiers de test ont correspondu au modèle spécifié. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 08954c552d..db015962fe 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1656,6 +1656,16 @@ Un totale di {0} file di test corrisponde al criterio specificato. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 972403200a..4303fea427 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1656,6 +1656,16 @@ 合計 {0} 個のテスト ファイルが指定されたパターンと一致しました。 + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 9779563bfe..674a2c5609 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1656,6 +1656,16 @@ 지정된 패턴과 일치한 총 테스트 파일 수는 {0}개입니다. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index a59a2094f1..d0d4746078 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1656,6 +1656,16 @@ Łączna liczba plików testowych dopasowanych do określonego wzorca: {0}. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 91f44a16f5..370ef41cfd 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1656,6 +1656,16 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a {0} arquivos de teste no total corresponderam ao padrão especificado. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 9d803eba73..6d1af5b9e7 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1656,6 +1656,16 @@ Общее количество тестовых файлов ({0}), соответствующих указанному шаблону. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 4bdadc4131..b8471712f9 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1656,6 +1656,16 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin Toplam {0} test dosyası belirtilen desenle eşleşti. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index ba252597b1..96da3d757c 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -847,6 +847,16 @@ A total of {0} test source files are discovered. + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 0ea23036ce..fbcbb0f157 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1655,6 +1655,16 @@ 总共 {0} 个测试文件与指定模式相匹配。 + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index abc2105532..c7581e2ec3 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1657,6 +1657,16 @@ 總共有 {0} 個測試檔案與指定的模式相符。 + + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + + + + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + \ No newline at end of file From 4da10464fa76fa07c374614bcc83467ff9b89bc8 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 24 Sep 2019 19:04:29 +0530 Subject: [PATCH 02/28] removed source in printing --- .../Logging/SourceSummary.cs | 15 +++++++ src/vstest.console/Internal/ConsoleLogger.cs | 39 +++++++------------ .../Resources/Resources.Designer.cs | 4 +- src/vstest.console/Resources/Resources.resx | 4 +- .../Resources/xlf/Resources.cs.xlf | 4 +- .../Resources/xlf/Resources.de.xlf | 4 +- .../Resources/xlf/Resources.es.xlf | 4 +- .../Resources/xlf/Resources.fr.xlf | 4 +- .../Resources/xlf/Resources.it.xlf | 4 +- .../Resources/xlf/Resources.ja.xlf | 4 +- .../Resources/xlf/Resources.ko.xlf | 4 +- .../Resources/xlf/Resources.pl.xlf | 4 +- .../Resources/xlf/Resources.pt-BR.xlf | 4 +- .../Resources/xlf/Resources.ru.xlf | 4 +- .../Resources/xlf/Resources.tr.xlf | 4 +- .../Resources/xlf/Resources.xlf | 4 +- .../Resources/xlf/Resources.zh-Hans.xlf | 4 +- .../Resources/xlf/Resources.zh-Hant.xlf | 4 +- 18 files changed, 62 insertions(+), 56 deletions(-) create mode 100644 src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs diff --git a/src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs b/src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs new file mode 100644 index 0000000000..7936648759 --- /dev/null +++ b/src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging +{ + using System; + public class SourceSummary + { + public int TotalTests { get; set; } + public int PassedTests { get; set; } + public int FailedTests { get; set; } + public int SkippedTests { get; set; } + public TimeSpan TimeSpan { get; set; } + } +} diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 50a7e11d30..c7420604b5 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -17,7 +17,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.Utilities; - using CommandLineResources =Resources.Resources; + using CommandLineResources = Resources.Resources; /// /// Logger for sending output to the console. /// All the console logger messages prints to Standard Output with respective color, except OutputLevel.Error messages @@ -155,16 +155,7 @@ protected static IOutput Output /// public Verbosity VerbosityLevel => verbosityLevel; - public class Summary - { - public int Totaltests { get; set; } - public int Passedtests { get; set; } - public int Failedtests { get; set; } - public int Skippedtests { get; set; } - public TimeSpan timespan { get; set; } - } - - public ConcurrentDictionary SummaryDictionary { get; private set; } + public ConcurrentDictionary SummaryDictionary { get; private set; } #endregion @@ -201,7 +192,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Register for the discovery events. events.DiscoveryMessage += this.TestMessageHandler; - SummaryDictionary = new ConcurrentDictionary(); + SummaryDictionary = new ConcurrentDictionary(); // TODO Get changes from https://github.com/Microsoft/vstest/pull/1111/ // events.DiscoveredTests += DiscoveredTestsHandler; @@ -479,17 +470,17 @@ private void TestResultHandler(object sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - SummaryDictionary.TryGetValue(e.Result.TestCase.Source, out var summary); - if (summary == null) + SourceSummary summary; + if (!SummaryDictionary.TryGetValue(e.Result.TestCase.Source, out summary)) { - summary = new Summary(); + summary = new SourceSummary(); SummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); } // Update the test count statistics based on the result of the test. this.testsTotal++; - summary.Totaltests++; - summary.timespan += e.Result.EndTime - e.Result.StartTime; + summary.TotalTests++; + summary.TimeSpan += e.Result.EndTime - e.Result.StartTime; var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) @@ -508,7 +499,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Skipped: { this.testsSkipped++; - summary.Skippedtests++; + summary.SkippedTests++; if (this.verbosityLevel == Verbosity.Quiet) { break; @@ -533,7 +524,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Failed: { this.testsFailed++; - summary.Failedtests++; + summary.FailedTests++; if (this.verbosityLevel == Verbosity.Quiet) { break; @@ -555,7 +546,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Passed: { this.testsPassed++; - summary.Passedtests++; + summary.PassedTests++; if (this.verbosityLevel == Verbosity.Normal || this.verbosityLevel == Verbosity.Detailed) { // Pause the progress indicator before displaying test result information @@ -650,14 +641,14 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) var summary = SummaryDictionary[sd.Key]; // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) - if (summary.Failedtests > 0) + if (summary.FailedTests > 0) { - Output.Information(false, ConsoleColor.White, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.Passedtests,summary.Failedtests,summary.Skippedtests, GetFormattedDurationString(summary.timespan),sd.Key.Split('\\').Last())); + Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last())); } else { - Output.Information(false, ConsoleColor.White, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed,summary.Totaltests, summary.Passedtests, summary.Failedtests, summary.Skippedtests, GetFormattedDurationString(summary.timespan), sd.Key.Split('\\').Last())); - } + Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last())); + } } return; } diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 3b134e26df..9800c79bc8 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1551,7 +1551,7 @@ internal static string TestRunSuccessful { } /// - /// Looks up a localized string similar to Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4}. + /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}.. /// internal static string TestRunSummaryFailed { get { @@ -1578,7 +1578,7 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } /// - /// Looks up a localized string similar to Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5}. + /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. /// internal static string TestRunSummaryPassed { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 6090249ead..36170263b0 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -735,9 +735,9 @@ A total of {0} test files matched the specified pattern. - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5} \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 2303ceb367..d456ddc653 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index cc0b72b8cc..7ea72e03f0 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index a7fd505028..e3425bb85b 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1660,12 +1660,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 3d9925ee7d..3ccecb1fbc 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index db015962fe..3a5901068c 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 4303fea427..d995b0c2f6 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 674a2c5609..3c70436a5c 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index d0d4746078..e715718242 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 370ef41cfd..e69a353bbf 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1657,12 +1657,12 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 6d1af5b9e7..d68efd61e0 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1657,12 +1657,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index b8471712f9..df94f2c2d8 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1657,12 +1657,12 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 96da3d757c..0b964265e0 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -848,12 +848,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index fbcbb0f157..b1030d0325 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1656,12 +1656,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index c7581e2ec3..585c69ec2a 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1658,12 +1658,12 @@ - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} From 5bda2eefaeb300ea9ca3b346d19fcc91537c7073 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 26 Sep 2019 15:50:38 +0530 Subject: [PATCH 03/28] added tests --- src/vstest.console/Internal/ConsoleLogger.cs | 2 +- .../Internal/ConsoleLoggerTests.cs | 66 +++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index c7420604b5..5de41f47d6 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -480,7 +480,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) // Update the test count statistics based on the result of the test. this.testsTotal++; summary.TotalTests++; - summary.TimeSpan += e.Result.EndTime - e.Result.StartTime; + summary.TimeSpan += e.Result.Duration; var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index ea4b011ec1..022254693b 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -21,7 +21,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Internal using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using vstest.console.Internal; - using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + using CommandLineResources = Resources.Resources; [TestClass] public class ConsoleLoggerTests @@ -366,7 +366,6 @@ public void InQuietModeTestErrorMessageShowShouldShowTestRunFailed() loggerEvents.WaitForEventCompletion(); // Verify - this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.TestRunFailed, OutputLevel.Error), Times.Once()); this.mockOutput.Verify(o => o.WriteLine(message, OutputLevel.Error), Times.Once()); } @@ -572,6 +571,44 @@ public void TestResultHandlerShouldWriteToConsoleShouldShowPassedTestsForNormalV this.mockProgressIndicator.Verify(pi => pi.Start(), Times.Exactly(5)); } + [TestMethod] + public void TestResultHandlerShouldWriteToConsoleShouldShowFailedTestsForQuietVebosity() + { + var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); + loggerEvents.EnableEvents(); + var parameters = new Dictionary(); + parameters.Add("verbosity", "quiet"); + this.consoleLogger.Initialize(loggerEvents, parameters); + + foreach (var testResult in this.GetTestResultsObject()) + { + loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); + } + loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Once); + } + + [TestMethod] + public void TestResultHandlerShouldWriteToConsoleShouldShowPassedTestsForQuietVebosity() + { + var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); + loggerEvents.EnableEvents(); + var parameters = new Dictionary(); + parameters.Add("verbosity", "quiet"); + this.consoleLogger.Initialize(loggerEvents, parameters); + + foreach (var testResult in this.GetPassedTestResultsObject()) + { + loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); + } + loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSource"), OutputLevel.Information), Times.Once); + } + [TestMethod] public void TestResultHandlerShouldNotShowNotStdOutMsgOfPassedTestIfVerbosityIsNormal() { @@ -977,7 +1014,7 @@ public void DisplayFullInformationShouldWriteStdMessageWithNewLine() this.consoleLogger.Initialize(loggerEvents, parameters); var testresults = this.GetTestResultObject(TestOutcome.Passed); - testresults[0].Messages.Add(new TestResultMessage (TestResultMessage.StandardOutCategory, "Hello")); + testresults[0].Messages.Add(new TestResultMessage(TestResultMessage.StandardOutCategory, "Hello")); foreach (var testResult in testresults) { @@ -1096,7 +1133,28 @@ private void Setup() return testresultList; } - + private List GetPassedTestResultsObject() + { + var testcase = new TestCase("DymmyNamespace.DummyClass.TestName", new Uri("some://uri"), "TestSource") + { + DisplayName = "TestName" + }; + + var testresult = new ObjectModel.TestResult(testcase) + { + Outcome = TestOutcome.Passed, + Duration = new TimeSpan(0, 0, 1, 2, 3) + }; + + var testresult1 = new ObjectModel.TestResult(testcase) + { + Outcome = TestOutcome.Skipped + }; + + var testresultList = new List { testresult, testresult1 }; + + return testresultList; + } private List GetTestResultObject(TestOutcome outcome) From 103ee9ec50db8e0458f81373dfd8ed962f06369d Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 3 Oct 2019 14:42:11 +0530 Subject: [PATCH 04/28] added tests,changed private members of summary info to local members --- src/vstest.console/Internal/ConsoleLogger.cs | 39 +++++++++------- .../Resources/Resources.Designer.cs | 4 +- src/vstest.console/Resources/Resources.resx | 4 +- .../Resources/xlf/Resources.cs.xlf | 4 +- .../Resources/xlf/Resources.de.xlf | 4 +- .../Resources/xlf/Resources.es.xlf | 4 +- .../Resources/xlf/Resources.fr.xlf | 4 +- .../Resources/xlf/Resources.it.xlf | 4 +- .../Resources/xlf/Resources.ja.xlf | 4 +- .../Resources/xlf/Resources.ko.xlf | 4 +- .../Resources/xlf/Resources.pl.xlf | 4 +- .../Resources/xlf/Resources.pt-BR.xlf | 4 +- .../Resources/xlf/Resources.ru.xlf | 4 +- .../Resources/xlf/Resources.tr.xlf | 4 +- .../Resources/xlf/Resources.xlf | 4 +- .../Resources/xlf/Resources.zh-Hans.xlf | 4 +- .../Resources/xlf/Resources.zh-Hant.xlf | 4 +- .../Internal/ConsoleLoggerTests.cs | 45 ++++++++++++++++++- 18 files changed, 99 insertions(+), 49 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 5de41f47d6..1b5c564495 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -107,10 +107,6 @@ internal enum Verbosity private Verbosity verbosityLevel = Verbosity.Minimal; #endif - private int testsTotal = 0; - private int testsPassed = 0; - private int testsFailed = 0; - private int testsSkipped = 0; private bool testRunHasErrorMessages = false; #endregion @@ -155,7 +151,10 @@ protected static IOutput Output /// public Verbosity VerbosityLevel => verbosityLevel; - public ConcurrentDictionary SummaryDictionary { get; private set; } + /// + /// Dictionary of summary of each source. + /// + private ConcurrentDictionary SourceSummaryDictionary { get; set; } #endregion @@ -192,7 +191,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Register for the discovery events. events.DiscoveryMessage += this.TestMessageHandler; - SummaryDictionary = new ConcurrentDictionary(); + SourceSummaryDictionary = new ConcurrentDictionary(); // TODO Get changes from https://github.com/Microsoft/vstest/pull/1111/ // events.DiscoveredTests += DiscoveredTestsHandler; @@ -471,14 +470,13 @@ private void TestResultHandler(object sender, TestResultEventArgs e) ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); SourceSummary summary; - if (!SummaryDictionary.TryGetValue(e.Result.TestCase.Source, out summary)) + if (!SourceSummaryDictionary.TryGetValue(e.Result.TestCase.Source, out summary)) { summary = new SourceSummary(); - SummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); + SourceSummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); } // Update the test count statistics based on the result of the test. - this.testsTotal++; summary.TotalTests++; summary.TimeSpan += e.Result.Duration; var testDisplayName = e.Result.DisplayName; @@ -498,7 +496,6 @@ private void TestResultHandler(object sender, TestResultEventArgs e) { case TestOutcome.Skipped: { - this.testsSkipped++; summary.SkippedTests++; if (this.verbosityLevel == Verbosity.Quiet) { @@ -523,7 +520,6 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Failed: { - this.testsFailed++; summary.FailedTests++; if (this.verbosityLevel == Verbosity.Quiet) { @@ -545,7 +541,6 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Passed: { - this.testsPassed++; summary.PassedTests++; if (this.verbosityLevel == Verbosity.Normal || this.verbosityLevel == Verbosity.Detailed) { @@ -632,13 +627,13 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { // Stop the progress indicator as we are about to print the summary this.progressIndicator?.Stop(); + SourceSummary summary; Output.WriteLine(string.Empty, OutputLevel.Information); - if (verbosityLevel == Verbosity.Quiet) { - foreach (var sd in SummaryDictionary.ToArray()) + foreach (var sd in SourceSummaryDictionary.ToArray()) { - var summary = SummaryDictionary[sd.Key]; + summary = SourceSummaryDictionary[sd.Key]; // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) if (summary.FailedTests > 0) @@ -652,6 +647,18 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } return; } + var testsPassed = 0; + var testsFailed = 0; + var testsSkipped = 0; + var testsTotal = 0; + foreach (var sd in SourceSummaryDictionary.ToArray()) + { + summary = SourceSummaryDictionary[sd.Key]; + testsPassed = summary.PassedTests; + testsFailed = summary.FailedTests; + testsSkipped = summary.SkippedTests; + testsTotal = summary.TotalTests; + } // Printing Run-level Attachments var runLevelAttachementCount = (e.AttachmentSets == null) ? 0 : e.AttachmentSets.Sum(attachmentSet => attachmentSet.Attachments.Count); @@ -676,7 +683,7 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { Output.Error(false, CommandLineResources.TestRunAborted); } - else if (this.testsFailed > 0 || this.testRunHasErrorMessages) + else if (testsFailed > 0 || this.testRunHasErrorMessages) { Output.Error(false, CommandLineResources.TestRunFailed); } diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 9800c79bc8..59940a5c61 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1551,7 +1551,7 @@ internal static string TestRunSuccessful { } /// - /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}.. + /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}).. /// internal static string TestRunSummaryFailed { get { @@ -1578,7 +1578,7 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } /// - /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). /// internal static string TestRunSummaryPassed { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 36170263b0..83a11c058d 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -735,9 +735,9 @@ A total of {0} test files matched the specified pattern. - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index d456ddc653..83471e822d 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 7ea72e03f0..86c8a25289 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index e3425bb85b..692b5dc602 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1660,12 +1660,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 3ccecb1fbc..a3e585e943 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 3a5901068c..e79057753c 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index d995b0c2f6..19ee0064c9 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 3c70436a5c..a227e95b75 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index e715718242..be28224486 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index e69a353bbf..53c74cc235 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1657,12 +1657,12 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index d68efd61e0..33925749d2 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index df94f2c2d8..efcd03a91c 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1657,12 +1657,12 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 0b964265e0..b3bcad2ada 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -848,12 +848,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index b1030d0325..af959d3634 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1656,12 +1656,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 585c69ec2a..3b171b5c36 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1658,12 +1658,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. {5}. + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}, Time: {4}. {5} + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 022254693b..cdac65483f 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -347,7 +347,7 @@ public void TestRunErrorMessageShowShouldTestRunFailed() } [TestMethod] - public void InQuietModeTestErrorMessageShowShouldShowTestRunFailed() + public void InQuietModeTestErrorMessageShouldShowTestRunFailed() { // Setup var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); @@ -590,6 +590,49 @@ public void TestResultHandlerShouldWriteToConsoleShouldShowFailedTestsForQuietVe this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Once); } + [TestMethod] + [DataRow("noraml")] + [DataRow("detailed")] + public void TestResultHandlerShouldWriteToConsoleShouldNotShowformatedFailedTestsForOtherThanQuietVebosity(string verbosityLevel) + { + var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); + loggerEvents.EnableEvents(); + var parameters = new Dictionary(); + parameters.Add("verbosity", verbosityLevel); + this.consoleLogger.Initialize(loggerEvents, parameters); + + foreach (var testResult in this.GetTestResultsObject()) + { + loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); + } + loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "(TestSource)"), OutputLevel.Information), Times.Never); + } + + + [TestMethod] + [DataRow("noraml")] + [DataRow("detailed")] + public void TestResultHandlerShouldWriteToConsoleShouldShowformatedPassesdTestsForOtherThanQuietVebosity(string verbosityLevel) + { + var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); + loggerEvents.EnableEvents(); + var parameters = new Dictionary(); + parameters.Add("verbosity", verbosityLevel); + this.consoleLogger.Initialize(loggerEvents, parameters); + + foreach (var testResult in this.GetPassedTestResultsObject()) + { + loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); + } + loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSource"), OutputLevel.Information), Times.Never); + } + [TestMethod] public void TestResultHandlerShouldWriteToConsoleShouldShowPassedTestsForQuietVebosity() { From afeda964b51e74234b412c39026da63a81083853 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 3 Oct 2019 15:07:55 +0530 Subject: [PATCH 05/28] naming corrected --- src/vstest.console/Internal/ConsoleLogger.cs | 25 ++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 1b5c564495..b35b2fd345 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -154,7 +154,7 @@ protected static IOutput Output /// /// Dictionary of summary of each source. /// - private ConcurrentDictionary SourceSummaryDictionary { get; set; } + private ConcurrentDictionary sourceSummaryDictionary { get; set; } #endregion @@ -191,7 +191,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Register for the discovery events. events.DiscoveryMessage += this.TestMessageHandler; - SourceSummaryDictionary = new ConcurrentDictionary(); + this.sourceSummaryDictionary = new ConcurrentDictionary(); // TODO Get changes from https://github.com/Microsoft/vstest/pull/1111/ // events.DiscoveredTests += DiscoveredTestsHandler; @@ -470,10 +470,10 @@ private void TestResultHandler(object sender, TestResultEventArgs e) ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); SourceSummary summary; - if (!SourceSummaryDictionary.TryGetValue(e.Result.TestCase.Source, out summary)) + if (!this.sourceSummaryDictionary.TryGetValue(e.Result.TestCase.Source, out summary)) { summary = new SourceSummary(); - SourceSummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); + this.sourceSummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); } // Update the test count statistics based on the result of the test. @@ -628,12 +628,16 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) // Stop the progress indicator as we are about to print the summary this.progressIndicator?.Stop(); SourceSummary summary; + var testsPassed = 0; + var testsFailed = 0; + var testsSkipped = 0; + var testsTotal = 0; Output.WriteLine(string.Empty, OutputLevel.Information); if (verbosityLevel == Verbosity.Quiet) { - foreach (var sd in SourceSummaryDictionary.ToArray()) + foreach (var sd in this.sourceSummaryDictionary.ToArray()) { - summary = SourceSummaryDictionary[sd.Key]; + summary = this.sourceSummaryDictionary[sd.Key]; // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) if (summary.FailedTests > 0) @@ -647,13 +651,10 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } return; } - var testsPassed = 0; - var testsFailed = 0; - var testsSkipped = 0; - var testsTotal = 0; - foreach (var sd in SourceSummaryDictionary.ToArray()) + + foreach (var sd in this.sourceSummaryDictionary.ToArray()) { - summary = SourceSummaryDictionary[sd.Key]; + summary = this.sourceSummaryDictionary[sd.Key]; testsPassed = summary.PassedTests; testsFailed = summary.FailedTests; testsSkipped = summary.SkippedTests; From dbd9b7ecfc0d6ba620475679c08c74b01a0b4eb4 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 3 Oct 2019 17:49:50 +0530 Subject: [PATCH 06/28] combined two for loops to one for loop --- src/vstest.console/Internal/ConsoleLogger.cs | 27 +++++----- .../Internal/ConsoleLoggerTests.cs | 51 +++++-------------- 2 files changed, 26 insertions(+), 52 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index b35b2fd345..7a1621d371 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -633,32 +633,33 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) var testsSkipped = 0; var testsTotal = 0; Output.WriteLine(string.Empty, OutputLevel.Information); - if (verbosityLevel == Verbosity.Quiet) + + foreach (var sd in this.sourceSummaryDictionary.ToArray()) { - foreach (var sd in this.sourceSummaryDictionary.ToArray()) - { - summary = this.sourceSummaryDictionary[sd.Key]; + summary = this.sourceSummaryDictionary[sd.Key]; + summary = this.sourceSummaryDictionary[sd.Key]; + testsPassed += summary.PassedTests; + testsFailed += summary.FailedTests; + testsSkipped += summary.SkippedTests; + testsTotal += summary.TotalTests; - // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) + if (verbosityLevel == Verbosity.Quiet) + { if (summary.FailedTests > 0) { + // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last())); } else { + // Passed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last())); } } - return; } - - foreach (var sd in this.sourceSummaryDictionary.ToArray()) + if (verbosityLevel == Verbosity.Quiet) { - summary = this.sourceSummaryDictionary[sd.Key]; - testsPassed = summary.PassedTests; - testsFailed = summary.FailedTests; - testsSkipped = summary.SkippedTests; - testsTotal = summary.TotalTests; + return; } // Printing Run-level Attachments diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index cdac65483f..4071bcf9f3 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -547,7 +547,7 @@ public void TestResultHandlerShouldNotShowAdditionalInfoBannerIfAdditionalInfoIs } [TestMethod] - public void TestResultHandlerShouldWriteToConsoleShouldShowPassedTestsForNormalVebosity() + public void TestResultHandlerShouldShowPassedTestsForNormalVebosity() { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); @@ -572,7 +572,7 @@ public void TestResultHandlerShouldWriteToConsoleShouldShowPassedTestsForNormalV } [TestMethod] - public void TestResultHandlerShouldWriteToConsoleShouldShowFailedTestsForQuietVebosity() + public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity() { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); @@ -584,38 +584,23 @@ public void TestResultHandlerShouldWriteToConsoleShouldShowFailedTestsForQuietVe { loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); } - loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); - loggerEvents.WaitForEventCompletion(); - - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Once); - } - [TestMethod] - [DataRow("noraml")] - [DataRow("detailed")] - public void TestResultHandlerShouldWriteToConsoleShouldNotShowformatedFailedTestsForOtherThanQuietVebosity(string verbosityLevel) - { - var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); - loggerEvents.EnableEvents(); - var parameters = new Dictionary(); - parameters.Add("verbosity", verbosityLevel); - this.consoleLogger.Initialize(loggerEvents, parameters); - - foreach (var testResult in this.GetTestResultsObject()) + foreach (var testResult in this.GetPassedTestResultsObject()) { loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); } + loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "(TestSource)"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Once); } - [TestMethod] [DataRow("noraml")] [DataRow("detailed")] - public void TestResultHandlerShouldWriteToConsoleShouldShowformatedPassesdTestsForOtherThanQuietVebosity(string verbosityLevel) + public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedForOtherThanQuietVebosity(string verbosityLevel) { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); @@ -623,33 +608,21 @@ public void TestResultHandlerShouldWriteToConsoleShouldShowformatedPassesdTestsF parameters.Add("verbosity", verbosityLevel); this.consoleLogger.Initialize(loggerEvents, parameters); - foreach (var testResult in this.GetPassedTestResultsObject()) + foreach (var testResult in this.GetTestResultsObject()) { loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); } - loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); - loggerEvents.WaitForEventCompletion(); - - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSource"), OutputLevel.Information), Times.Never); - } - - [TestMethod] - public void TestResultHandlerShouldWriteToConsoleShouldShowPassedTestsForQuietVebosity() - { - var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); - loggerEvents.EnableEvents(); - var parameters = new Dictionary(); - parameters.Add("verbosity", "quiet"); - this.consoleLogger.Initialize(loggerEvents, parameters); foreach (var testResult in this.GetPassedTestResultsObject()) { loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); } + loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSource"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "(TestSource)"), OutputLevel.Information), Times.Never); } [TestMethod] @@ -1178,7 +1151,7 @@ private void Setup() private List GetPassedTestResultsObject() { - var testcase = new TestCase("DymmyNamespace.DummyClass.TestName", new Uri("some://uri"), "TestSource") + var testcase = new TestCase("DymmyNamespace.DummyClass.TestName", new Uri("some://uri"), "TestSourcePassed") { DisplayName = "TestName" }; From bfb580406294606bf80e428329d3e572ea530047 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 4 Oct 2019 15:49:23 +0530 Subject: [PATCH 07/28] removed redundant code and fomatted --- src/vstest.console/Internal/ConsoleLogger.cs | 5 ++--- test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 7a1621d371..5b7706f652 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -627,7 +627,6 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { // Stop the progress indicator as we are about to print the summary this.progressIndicator?.Stop(); - SourceSummary summary; var testsPassed = 0; var testsFailed = 0; var testsSkipped = 0; @@ -636,8 +635,7 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) foreach (var sd in this.sourceSummaryDictionary.ToArray()) { - summary = this.sourceSummaryDictionary[sd.Key]; - summary = this.sourceSummaryDictionary[sd.Key]; + var summary = this.sourceSummaryDictionary[sd.Key]; testsPassed += summary.PassedTests; testsFailed += summary.FailedTests; testsSkipped += summary.SkippedTests; @@ -657,6 +655,7 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } } } + if (verbosityLevel == Verbosity.Quiet) { return; diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 4071bcf9f3..66a3f063e2 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -598,9 +598,9 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity } [TestMethod] - [DataRow("noraml")] + [DataRow("normal")] [DataRow("detailed")] - public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedForOtherThanQuietVebosity(string verbosityLevel) + public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForOtherThanQuietVebosity(string verbosityLevel) { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); From c952c427a4771223c8425535c85cc01463ac2f95 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 9 Oct 2019 11:33:51 +0530 Subject: [PATCH 08/28] modified resources --- src/vstest.console/Resources/Resources.Designer.cs | 2 +- src/vstest.console/Resources/Resources.resx | 2 +- src/vstest.console/Resources/xlf/Resources.cs.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.de.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.es.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.fr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.it.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ja.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ko.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pl.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pt-BR.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ru.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.tr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf | 2 +- test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 59940a5c61..2fba7a5de2 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1578,7 +1578,7 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } /// - /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}).. /// internal static string TestRunSummaryPassed { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 83a11c058d..7bd73496b8 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -738,6 +738,6 @@ Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 83471e822d..89eb4911fa 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 86c8a25289..49bc12ee44 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 692b5dc602..585ea09132 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1665,7 +1665,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index a3e585e943..8cc45b60e6 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index e79057753c..a01b4270c0 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 19ee0064c9..1b3cc7dbc6 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index a227e95b75..b021501630 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index be28224486..5d4e8da6f8 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 53c74cc235..991a8f9318 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1662,7 +1662,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 33925749d2..1a00cb0dd4 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1662,7 +1662,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index efcd03a91c..e5333674a6 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1662,7 +1662,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index b3bcad2ada..3a3e2bfe7a 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -853,7 +853,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index af959d3634..ac8f280444 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1661,7 +1661,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 3b171b5c36..6cd6916b5d 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1663,7 +1663,7 @@ - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}) + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 66a3f063e2..8b8a86f44e 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -622,7 +622,7 @@ public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForO loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed"), OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "(TestSource)"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Never); } [TestMethod] From 3391a7290b9e6b80a51400ff446e3214009b3efe Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Mon, 21 Oct 2019 17:39:31 +0530 Subject: [PATCH 09/28] added target framework in quiet case --- src/vstest.console/Internal/ConsoleLogger.cs | 11 ++++++-- .../Resources/Resources.Designer.cs | 4 +-- src/vstest.console/Resources/Resources.resx | 4 +-- .../Resources/xlf/Resources.cs.xlf | 4 +-- .../Resources/xlf/Resources.de.xlf | 4 +-- .../Resources/xlf/Resources.es.xlf | 4 +-- .../Resources/xlf/Resources.fr.xlf | 4 +-- .../Resources/xlf/Resources.it.xlf | 4 +-- .../Resources/xlf/Resources.ja.xlf | 4 +-- .../Resources/xlf/Resources.ko.xlf | 4 +-- .../Resources/xlf/Resources.pl.xlf | 4 +-- .../Resources/xlf/Resources.pt-BR.xlf | 4 +-- .../Resources/xlf/Resources.ru.xlf | 4 +-- .../Resources/xlf/Resources.tr.xlf | 4 +-- .../Resources/xlf/Resources.xlf | 4 +-- .../Resources/xlf/Resources.zh-Hans.xlf | 4 +-- .../Resources/xlf/Resources.zh-Hant.xlf | 4 +-- .../Internal/ConsoleLoggerTests.cs | 28 ++++++++++++------- 18 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 5b7706f652..d19184220f 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -156,6 +156,8 @@ protected static IOutput Output /// private ConcurrentDictionary sourceSummaryDictionary { get; set; } + private string targetFramework; + #endregion #region ITestLoggerWithParameters @@ -227,6 +229,11 @@ public void Initialize(TestLoggerEvents events, Dictionary param bool.TryParse(noprogress, out DisableProgress); } + if (this.verbosityLevel == Verbosity.Quiet) + { + this.targetFramework = parameters[DefaultLoggerParameterNames.TargetFramework]; + } + Initialize(events, String.Empty); } #endregion @@ -646,12 +653,12 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (summary.FailedTests > 0) { // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) - Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last())); + Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); } else { // Passed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) - Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last())); + Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); } } } diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 2fba7a5de2..8f8db8ed96 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1551,7 +1551,7 @@ internal static string TestRunSuccessful { } /// - /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}).. + /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. /// internal static string TestRunSummaryFailed { get { @@ -1578,7 +1578,7 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } /// - /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}).. + /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. /// internal static string TestRunSummaryPassed { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 7bd73496b8..159a58459e 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -735,9 +735,9 @@ A total of {0} test files matched the specified pattern. - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 89eb4911fa..2ca5ec2928 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 49bc12ee44..c1c5525cbe 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 585ea09132..20de90704f 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1660,12 +1660,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 8cc45b60e6..0c8b430829 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index a01b4270c0..a1249e86e7 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 1b3cc7dbc6..77a760760e 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index b021501630..ab1d17da1c 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 5d4e8da6f8..ab01ecd44e 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 991a8f9318..5e7b894c59 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1657,12 +1657,12 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 1a00cb0dd4..54860a6a44 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index e5333674a6..ec83bc1c87 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1657,12 +1657,12 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 3a3e2bfe7a..3dada5dd5a 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -848,12 +848,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index ac8f280444..3a8207bf38 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1656,12 +1656,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 6cd6916b5d..df2d809a89 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1658,12 +1658,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. Time: {4}. ({5}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 8b8a86f44e..1ce072e695 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -354,7 +354,8 @@ public void InQuietModeTestErrorMessageShouldShowTestRunFailed() loggerEvents.EnableEvents(); var parameters = new Dictionary { - { "verbosity", "quiet" } + { "verbosity", "quiet" }, + { DefaultLoggerParameterNames.TargetFramework , "abc" } }; this.consoleLogger.Initialize(loggerEvents, parameters); @@ -377,7 +378,8 @@ public void InQuietModeTestWarningMessageShouldNotShow() loggerEvents.EnableEvents(); var parameters = new Dictionary { - { "verbosity", "quiet" } + { "verbosity", "quiet" }, + { DefaultLoggerParameterNames.TargetFramework , "abc" } }; this.consoleLogger.Initialize(loggerEvents, parameters); @@ -576,8 +578,11 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); - var parameters = new Dictionary(); - parameters.Add("verbosity", "quiet"); + var parameters = new Dictionary + { + { "verbosity", "quiet" }, + { DefaultLoggerParameterNames.TargetFramework , "abc"} + }; this.consoleLogger.Initialize(loggerEvents, parameters); foreach (var testResult in this.GetTestResultsObject()) @@ -593,8 +598,8 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed"), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed", "abc"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource", "abc"), OutputLevel.Information), Times.Once); } [TestMethod] @@ -621,8 +626,8 @@ public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForO loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed"), OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed", "abc"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource", "abc"), OutputLevel.Information), Times.Never); } [TestMethod] @@ -703,8 +708,11 @@ public void TestResultHandlerShouldWriteToNoTestResultForQuietVerbosity() { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); - var parameters = new Dictionary(); - parameters.Add("verbosity", "Quiet"); + var parameters = new Dictionary + { + { "verbosity", "quiet" }, + { DefaultLoggerParameterNames.TargetFramework , "abc"} + }; this.consoleLogger.Initialize(loggerEvents, parameters); foreach (var testResult in this.GetTestResultsObject()) From ed14b111f4b55ffee3d5ad77b2eb21e76d10741a Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 23 Oct 2019 12:36:07 +0530 Subject: [PATCH 10/28] added yellow colour to passed and skipped --- src/vstest.console/Internal/ConsoleLogger.cs | 24 ++++++---- .../Resources/Resources.Designer.cs | 4 +- src/vstest.console/Resources/Resources.resx | 4 +- .../Resources/xlf/Resources.cs.xlf | 4 +- .../Resources/xlf/Resources.de.xlf | 4 +- .../Resources/xlf/Resources.es.xlf | 4 +- .../Resources/xlf/Resources.fr.xlf | 4 +- .../Resources/xlf/Resources.it.xlf | 4 +- .../Resources/xlf/Resources.ja.xlf | 4 +- .../Resources/xlf/Resources.ko.xlf | 4 +- .../Resources/xlf/Resources.pl.xlf | 4 +- .../Resources/xlf/Resources.pt-BR.xlf | 4 +- .../Resources/xlf/Resources.ru.xlf | 4 +- .../Resources/xlf/Resources.tr.xlf | 4 +- .../Resources/xlf/Resources.xlf | 4 +- .../Resources/xlf/Resources.zh-Hans.xlf | 4 +- .../Resources/xlf/Resources.zh-Hant.xlf | 4 +- .../Internal/ConsoleLoggerTests.cs | 45 ++++++++++--------- 18 files changed, 72 insertions(+), 61 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index d19184220f..364ece136f 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -16,7 +16,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.Utilities; - + using NuGet.Frameworks; using CommandLineResources = Resources.Resources; /// /// Logger for sending output to the console. @@ -232,6 +232,7 @@ public void Initialize(TestLoggerEvents events, Dictionary param if (this.verbosityLevel == Verbosity.Quiet) { this.targetFramework = parameters[DefaultLoggerParameterNames.TargetFramework]; + this.targetFramework = NuGetFramework.Parse(this.targetFramework).GetShortFolderName(); } Initialize(events, String.Empty); @@ -603,28 +604,28 @@ private string GetFormattedDurationString(TimeSpan duration) var time = new List(); if (duration.Hours > 0) { - time.Add(duration.Hours + "h"); + time.Add(duration.Hours + " h"); } if (duration.Minutes > 0) { - time.Add(duration.Minutes + "m"); + time.Add(duration.Minutes + " m"); } if (duration.Hours == 0) { if (duration.Seconds > 0) { - time.Add(duration.Seconds + "s"); + time.Add(duration.Seconds + " s"); } if (duration.Milliseconds > 0 && duration.Minutes == 0) { - time.Add(duration.Milliseconds + "ms"); + time.Add(duration.Milliseconds + " ms"); } } - return time.Count == 0 ? "< 1ms" : string.Join(" ", time); + return time.Count == 0 ? "< 1 ms" : string.Join(" ", time); } /// @@ -657,8 +658,15 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } else { - // Passed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) - Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); + if (summary.SkippedTests > 0) + { + Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); + } + else + { + // Passed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) + Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); + } } } } diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 8f8db8ed96..838035aec5 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1551,7 +1551,7 @@ internal static string TestRunSuccessful { } /// - /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. + /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. /// internal static string TestRunSummaryFailed { get { @@ -1578,7 +1578,7 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } /// - /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. + /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. /// internal static string TestRunSummaryPassed { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 159a58459e..8d01608959 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -735,9 +735,9 @@ A total of {0} test files matched the specified pattern. - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 2ca5ec2928..1f757db832 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index c1c5525cbe..b36ec58991 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 20de90704f..f1ac8dfaed 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1660,12 +1660,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 0c8b430829..085d466dfa 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index a1249e86e7..316cd68986 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 77a760760e..59315b7331 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index ab1d17da1c..968eb99ab4 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index ab01ecd44e..f01da73ef5 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 5e7b894c59..6577993905 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1657,12 +1657,12 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 54860a6a44..0c3abbfb9a 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1657,12 +1657,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index ec83bc1c87..76a93b0fa8 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1657,12 +1657,12 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 3dada5dd5a..a2780cbc35 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -848,12 +848,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 3a8207bf38..1312b5740b 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1656,12 +1656,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index df2d809a89..f5d7fa3214 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1658,12 +1658,12 @@ - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 1ce072e695..1d73a7de82 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -564,9 +564,9 @@ public void TestResultHandlerShouldShowPassedTestsForNormalVebosity() loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.Write(PassedTestIndicator, OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine("TestName [1h 2m]", OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine("TestName [1 h 2 m]", OutputLevel.Information), Times.Once); this.mockOutput.Verify(o => o.Write(FailedTestIndicator, OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine("TestName [4m 5s]", OutputLevel.Information), Times.Once()); + this.mockOutput.Verify(o => o.WriteLine("TestName [4 m 5 s]", OutputLevel.Information), Times.Once()); this.mockOutput.Verify(o => o.Write(SkippedTestIndicator, OutputLevel.Information), Times.Exactly(3)); this.mockOutput.Verify(o => o.WriteLine("TestName", OutputLevel.Information), Times.Exactly(3)); this.mockProgressIndicator.Verify(pi => pi.Pause(), Times.Exactly(5)); @@ -581,7 +581,7 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity var parameters = new Dictionary { { "verbosity", "quiet" }, - { DefaultLoggerParameterNames.TargetFramework , "abc"} + { DefaultLoggerParameterNames.TargetFramework , ".NETFramework,version=v4.5.1"} }; this.consoleLogger.Initialize(loggerEvents, parameters); @@ -598,8 +598,8 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed", "abc"), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource", "abc"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "net451"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1 h 6 m", "TestSource", "net451"), OutputLevel.Information), Times.Once); } [TestMethod] @@ -609,8 +609,11 @@ public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForO { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); - var parameters = new Dictionary(); - parameters.Add("verbosity", verbosityLevel); + var parameters = new Dictionary + { + { "verbosity", verbosityLevel }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; this.consoleLogger.Initialize(loggerEvents, parameters); foreach (var testResult in this.GetTestResultsObject()) @@ -626,8 +629,8 @@ public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForO loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1m 2s", "TestSourcePassed", "abc"), OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1h 6m", "TestSource", "abc"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "net451"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1 h 6 m", "TestSource", "net451"), OutputLevel.Information), Times.Never); } [TestMethod] @@ -696,9 +699,9 @@ public void TestResultHandlerShouldWriteToConsoleButSkipPassedTestsForMinimalVer loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.Write(PassedTestIndicator, OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine("TestName [1h 2m]", OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine("TestName [1 h 2 m]", OutputLevel.Information), Times.Never); this.mockOutput.Verify(o => o.Write(FailedTestIndicator, OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine("TestName [4m 5s]", OutputLevel.Information), Times.Once()); + this.mockOutput.Verify(o => o.WriteLine("TestName [4 m 5 s]", OutputLevel.Information), Times.Once()); this.mockOutput.Verify(o => o.Write(SkippedTestIndicator, OutputLevel.Information), Times.Exactly(3)); this.mockOutput.Verify(o => o.WriteLine("TestName", OutputLevel.Information), Times.Exactly(3)); } @@ -711,7 +714,7 @@ public void TestResultHandlerShouldWriteToNoTestResultForQuietVerbosity() var parameters = new Dictionary { { "verbosity", "quiet" }, - { DefaultLoggerParameterNames.TargetFramework , "abc"} + { DefaultLoggerParameterNames.TargetFramework , "net451"} }; this.consoleLogger.Initialize(loggerEvents, parameters); @@ -721,18 +724,18 @@ public void TestResultHandlerShouldWriteToNoTestResultForQuietVerbosity() } loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.PassedTestIndicator, "TestName [1h 2m]"), OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.FailedTestIndicator, "TestName [4m 5s]"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.PassedTestIndicator, "TestName [1 h 2 m]"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.FailedTestIndicator, "TestName [4 m 5 s]"), OutputLevel.Information), Times.Never); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.SkippedTestIndicator, "TestName"), OutputLevel.Warning), Times.Never); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.NotRunTestIndicator, "TestName"), OutputLevel.Information), Times.Never); } - [DataRow("[1h 2m]", new int[5] { 0, 1, 2, 3, 78 })] - [DataRow("[4m 3s]", new int[5] { 0, 0, 4, 3, 78 })] - [DataRow("[3s 78ms]", new int[5] { 0, 0, 0, 3, 78 })] - [DataRow("[78ms]", new int[5] { 0, 0, 0, 0, 78 })] - [DataRow("[1h]", new int[5] { 0, 1, 0, 5, 78 })] - [DataRow("[5m]", new int[5] { 0, 0, 5, 0, 78 })] + [DataRow("[1 h 2 m]", new int[5] { 0, 1, 2, 3, 78 })] + [DataRow("[4 m 3 s]", new int[5] { 0, 0, 4, 3, 78 })] + [DataRow("[3 s 78 ms]", new int[5] { 0, 0, 0, 3, 78 })] + [DataRow("[78 ms]", new int[5] { 0, 0, 0, 0, 78 })] + [DataRow("[1 h]", new int[5] { 0, 1, 0, 5, 78 })] + [DataRow("[5 m]", new int[5] { 0, 0, 5, 0, 78 })] [DataTestMethod] public void TestResultHandlerForTestResultWithDurationShouldPrintDurationInfo(string expectedDuration, int[] timeSpanArgs) { @@ -772,7 +775,7 @@ public void TestResultHandlerForTestResultWithDurationLessThanOneMsShouldPrintDu loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.Write(PassedTestIndicator, OutputLevel.Information), Times.Once()); - this.mockOutput.Verify(o => o.WriteLine("TestName [< 1ms]", OutputLevel.Information), Times.Once()); + this.mockOutput.Verify(o => o.WriteLine("TestName [< 1 ms]", OutputLevel.Information), Times.Once()); } [TestMethod] From 3250de1bad9a5d1ef36c40f26fef56ba948d820c Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 24 Oct 2019 17:33:57 +0530 Subject: [PATCH 11/28] if cases formatted --- src/vstest.console/Internal/ConsoleLogger.cs | 36 +++++++++---------- .../Resources/Resources.Designer.cs | 15 ++------ src/vstest.console/Resources/Resources.resx | 7 ++-- .../Resources/xlf/Resources.cs.xlf | 11 ++---- .../Resources/xlf/Resources.de.xlf | 11 ++---- .../Resources/xlf/Resources.es.xlf | 11 ++---- .../Resources/xlf/Resources.fr.xlf | 11 ++---- .../Resources/xlf/Resources.it.xlf | 11 ++---- .../Resources/xlf/Resources.ja.xlf | 11 ++---- .../Resources/xlf/Resources.ko.xlf | 11 ++---- .../Resources/xlf/Resources.pl.xlf | 11 ++---- .../Resources/xlf/Resources.pt-BR.xlf | 11 ++---- .../Resources/xlf/Resources.ru.xlf | 11 ++---- .../Resources/xlf/Resources.tr.xlf | 11 ++---- .../Resources/xlf/Resources.xlf | 11 ++---- .../Resources/xlf/Resources.zh-Hans.xlf | 11 ++---- .../Resources/xlf/Resources.zh-Hant.xlf | 11 ++---- .../Internal/ConsoleLoggerTests.cs | 14 ++++---- 18 files changed, 72 insertions(+), 154 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 364ece136f..e48e4352ac 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -40,7 +40,7 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// private const char PassedTestIndicator = '\u221a'; - /// + /// /// Indicator for failed tests /// private const char FailedTestIndicator = 'X'; @@ -65,6 +65,11 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// public const string ExtensionUri = "logger://Microsoft/TestPlatform/ConsoleLogger/v1"; + /// + /// Represents failed tests. + /// + private const string Failed = "Failed"; + /// /// Alternate user friendly string to uniquely identify the console logger. /// @@ -75,6 +80,11 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// public const string VerbosityParam = "verbosity"; + /// + /// Represents Passed tests. + /// + private const string Passed = "Passed"; + /// /// Parameter for log message prefix /// @@ -232,7 +242,7 @@ public void Initialize(TestLoggerEvents events, Dictionary param if (this.verbosityLevel == Verbosity.Quiet) { this.targetFramework = parameters[DefaultLoggerParameterNames.TargetFramework]; - this.targetFramework = NuGetFramework.Parse(this.targetFramework).GetShortFolderName(); + this.targetFramework = !string.IsNullOrEmpty(this.targetFramework) ? NuGetFramework.Parse(this.targetFramework).GetShortFolderName() : this.targetFramework; } Initialize(events, String.Empty); @@ -651,23 +661,11 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (verbosityLevel == Verbosity.Quiet) { - if (summary.FailedTests > 0) - { - // Failed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) - Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); - } - else - { - if (summary.SkippedTests > 0) - { - Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); - } - else - { - // Passed! Pass {1} Failed {2} skipped {3} Time : 233 se ({4}) - Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), targetFramework)); - } - } + var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); + var resultString = summary.FailedTests > 0 ? Failed : Passed; + var color = summary.FailedTests > 0 ? ConsoleColor.Red : summary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; + var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString ,summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), frameworkString); + Output.Information(false, color, outputLine); } } diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 838035aec5..8f743b862f 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1551,11 +1551,11 @@ internal static string TestRunSuccessful { } /// - /// Looks up a localized string similar to Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. + /// Looks up a localized string similar to {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}.. /// - internal static string TestRunSummaryFailed { + internal static string TestRunSummary { get { - return ResourceManager.GetString("TestRunSummaryFailed", resourceCulture); + return ResourceManager.GetString("TestRunSummary", resourceCulture); } } @@ -1577,15 +1577,6 @@ internal static string TestRunSummaryForCanceledOrAbortedRun { } } - /// - /// Looks up a localized string similar to Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}).. - /// - internal static string TestRunSummaryPassed { - get { - return ResourceManager.GetString("TestRunSummaryPassed", resourceCulture); - } - } - /// /// Looks up a localized string similar to Passed: {0}. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 8d01608959..068b134c81 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -734,10 +734,7 @@ A total of {0} test files matched the specified pattern. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 1f757db832..c80bbeb476 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1656,14 +1656,9 @@ Celkový počet testovacích souborů, které odpovídají zadanému vzoru: {0} - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index b36ec58991..f7746d4d40 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1656,14 +1656,9 @@ Insgesamt {0} Testdateien stimmten mit dem angegebenen Muster überein. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index f1ac8dfaed..139aac60ca 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1659,14 +1659,9 @@ {0} archivos de prueba en total coincidieron con el patrón especificado. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 085d466dfa..de3b9ae331 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1656,14 +1656,9 @@ Au total, {0} fichiers de test ont correspondu au modèle spécifié. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 316cd68986..389f1f48a1 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1656,14 +1656,9 @@ Un totale di {0} file di test corrisponde al criterio specificato. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 59315b7331..7668e0b598 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1656,14 +1656,9 @@ 合計 {0} 個のテスト ファイルが指定されたパターンと一致しました。 - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 968eb99ab4..42e4e604b0 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1656,14 +1656,9 @@ 지정된 패턴과 일치한 총 테스트 파일 수는 {0}개입니다. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index f01da73ef5..833a717185 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1656,14 +1656,9 @@ Łączna liczba plików testowych dopasowanych do określonego wzorca: {0}. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 6577993905..eccd51ee07 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1656,14 +1656,9 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a {0} arquivos de teste no total corresponderam ao padrão especificado. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 0c3abbfb9a..d6d9a39451 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1656,14 +1656,9 @@ Общее количество тестовых файлов ({0}), соответствующих указанному шаблону. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 76a93b0fa8..9859126eaa 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1656,14 +1656,9 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin Toplam {0} test dosyası belirtilen desenle eşleşti. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index a2780cbc35..7c3cfb83a3 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -847,14 +847,9 @@ A total of {0} test source files are discovered. - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 1312b5740b..035af084b3 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1655,14 +1655,9 @@ 总共 {0} 个测试文件与指定模式相匹配。 - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index f5d7fa3214..7a711b9dc3 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1657,14 +1657,9 @@ 總共有 {0} 個測試檔案與指定的模式相符。 - - Failed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Failed! Pass:{0} Fail:{1} Skip:{2} Time:{3} Source:{4} - - - - Passed! Total: {0}. Pass: {1}. Fail: {2}. Skip: {3}. ({4}) {5} ({6}). - Passed! Total:{0} Pass:{1} Fail:{2} Skip:{3} Time:{4} Source:{5} + + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 1d73a7de82..15bf27678f 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -573,15 +573,17 @@ public void TestResultHandlerShouldShowPassedTestsForNormalVebosity() this.mockProgressIndicator.Verify(pi => pi.Start(), Times.Exactly(5)); } + [DataRow(".NETFramework,version=v4.5.1", "(net451)")] + [DataRow(null, null)] [TestMethod] - public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity() + public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity(string framework, string expectedFramework) { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); var parameters = new Dictionary { { "verbosity", "quiet" }, - { DefaultLoggerParameterNames.TargetFramework , ".NETFramework,version=v4.5.1"} + { DefaultLoggerParameterNames.TargetFramework , framework} }; this.consoleLogger.Initialize(loggerEvents, parameters); @@ -598,8 +600,8 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "net451"), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1 h 6 m", "TestSource", "net451"), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Passed", 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", expectedFramework), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Failed", 5, 1, 1, 1, "1 h 6 m", "TestSource", expectedFramework), OutputLevel.Information), Times.Once); } [TestMethod] @@ -629,8 +631,8 @@ public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForO loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "net451"), OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailed, 5, 1, 1, 1, "1 h 6 m", "TestSource", "net451"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Passed", 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "(net451)"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Failed", 5, 1, 1, 1, "1 h 6 m", "TestSource", "(net451)"), OutputLevel.Information), Times.Never); } [TestMethod] From d38829e49de818485289bf7d29d95a6569ee0de8 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 30 Oct 2019 14:36:05 +0530 Subject: [PATCH 12/28] paased failed to localized --- .../Logging/SourceSummary.cs | 15 -------- src/vstest.console/Internal/ConsoleLogger.cs | 25 +++++------- src/vstest.console/Internal/SourceSummary.cs | 38 +++++++++++++++++++ .../Resources/Resources.Designer.cs | 18 +++++++++ src/vstest.console/Resources/Resources.resx | 6 +++ .../Resources/xlf/Resources.cs.xlf | 10 +++++ .../Resources/xlf/Resources.de.xlf | 10 +++++ .../Resources/xlf/Resources.es.xlf | 10 +++++ .../Resources/xlf/Resources.fr.xlf | 10 +++++ .../Resources/xlf/Resources.it.xlf | 10 +++++ .../Resources/xlf/Resources.ja.xlf | 10 +++++ .../Resources/xlf/Resources.ko.xlf | 10 +++++ .../Resources/xlf/Resources.pl.xlf | 10 +++++ .../Resources/xlf/Resources.pt-BR.xlf | 10 +++++ .../Resources/xlf/Resources.ru.xlf | 10 +++++ .../Resources/xlf/Resources.tr.xlf | 10 +++++ .../Resources/xlf/Resources.xlf | 10 +++++ .../Resources/xlf/Resources.zh-Hans.xlf | 10 +++++ .../Resources/xlf/Resources.zh-Hant.xlf | 10 +++++ 19 files changed, 211 insertions(+), 31 deletions(-) delete mode 100644 src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs create mode 100644 src/vstest.console/Internal/SourceSummary.cs diff --git a/src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs b/src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs deleted file mode 100644 index 7936648759..0000000000 --- a/src/Microsoft.TestPlatform.ObjectModel/Logging/SourceSummary.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging -{ - using System; - public class SourceSummary - { - public int TotalTests { get; set; } - public int PassedTests { get; set; } - public int FailedTests { get; set; } - public int SkippedTests { get; set; } - public TimeSpan TimeSpan { get; set; } - } -} diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index e48e4352ac..ec8b19770c 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -40,7 +40,7 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// private const char PassedTestIndicator = '\u221a'; - /// + /// /// Indicator for failed tests /// private const char FailedTestIndicator = 'X'; @@ -65,11 +65,6 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// public const string ExtensionUri = "logger://Microsoft/TestPlatform/ConsoleLogger/v1"; - /// - /// Represents failed tests. - /// - private const string Failed = "Failed"; - /// /// Alternate user friendly string to uniquely identify the console logger. /// @@ -80,11 +75,6 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// public const string VerbosityParam = "verbosity"; - /// - /// Represents Passed tests. - /// - private const string Passed = "Passed"; - /// /// Parameter for log message prefix /// @@ -119,6 +109,11 @@ internal enum Verbosity private bool testRunHasErrorMessages = false; + /// + /// Framework on which the test runs. + /// + private string targetFramework; + #endregion #region Constructor @@ -166,8 +161,6 @@ protected static IOutput Output /// private ConcurrentDictionary sourceSummaryDictionary { get; set; } - private string targetFramework; - #endregion #region ITestLoggerWithParameters @@ -496,7 +489,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) // Update the test count statistics based on the result of the test. summary.TotalTests++; - summary.TimeSpan += e.Result.Duration; + summary.Duration += e.Result.Duration; var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) @@ -662,9 +655,9 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (verbosityLevel == Verbosity.Quiet) { var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); - var resultString = summary.FailedTests > 0 ? Failed : Passed; + var resultString = summary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; var color = summary.FailedTests > 0 ? ConsoleColor.Red : summary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; - var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString ,summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.TimeSpan), sd.Key.Split('\\').Last(), frameworkString); + var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.Duration), sd.Key.Split('\\').Last(), frameworkString); Output.Information(false, color, outputLine); } } diff --git a/src/vstest.console/Internal/SourceSummary.cs b/src/vstest.console/Internal/SourceSummary.cs new file mode 100644 index 0000000000..d0f228b6de --- /dev/null +++ b/src/vstest.console/Internal/SourceSummary.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal +{ + using System; + + /// + /// Summary of test results per source. + /// + internal class SourceSummary + { + /// + /// Total tests of a test run. + /// + public int TotalTests { get; set; } + + /// + /// Passed tests of a test run. + /// + public int PassedTests { get; set; } + + /// + /// Failed tests of a test run. + /// + public int FailedTests { get; set; } + + /// + /// Skipped tests of a test run. + /// + public int SkippedTests { get; set; } + + /// + /// Duration of the test run. + /// + public TimeSpan Duration { get; set; } + } +} diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 8f743b862f..25e426358d 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -549,6 +549,15 @@ internal static string ExtensionUriFormat { } } + /// + /// Looks up a localized string similar to Failed. + /// + internal static string Failed { + get { + return ResourceManager.GetString("Failed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed {0}. /// @@ -1097,6 +1106,15 @@ internal static string ParentProcessIdArgumentHelp { } } + /// + /// Looks up a localized string similar to Passed. + /// + internal static string Passed { + get { + return ResourceManager.GetString("Passed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Passed {0}. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 068b134c81..7a0b02851b 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -737,4 +737,10 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + + + Passed + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index c80bbeb476..ee46fce024 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index f7746d4d40..084a5d7600 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 139aac60ca..b83fc0e50b 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1664,6 +1664,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index de3b9ae331..4ba849386c 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 389f1f48a1..84bd80a6eb 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 7668e0b598..32891cd692 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 42e4e604b0..6f9712a9f5 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 833a717185..d74fefae12 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index eccd51ee07..fd742e117d 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1661,6 +1661,16 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index d6d9a39451..8048350937 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1661,6 +1661,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 9859126eaa..65a3deb04d 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1661,6 +1661,16 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 7c3cfb83a3..0dfb1ec3a7 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -852,6 +852,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 035af084b3..0751be05cf 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1660,6 +1660,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 7a711b9dc3..7352a5a3e2 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1662,6 +1662,16 @@ {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + + Failed + Failed + + + + Passed + Passed + + \ No newline at end of file From 8ab3fa20ffaad68e3e0220b6a4ac4ccf05925627 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 30 Oct 2019 15:20:20 +0530 Subject: [PATCH 13/28] passed and failed in unit tests changed to localized --- .../Internal/ConsoleLoggerTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 15bf27678f..3f2e9b2a1b 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -600,8 +600,8 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Passed", 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", expectedFramework), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Failed", 5, 1, 1, 1, "1 h 6 m", "TestSource", expectedFramework), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Passed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", expectedFramework), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Failed, 5, 1, 1, 1, "1 h 6 m", "TestSource", expectedFramework), OutputLevel.Information), Times.Once); } [TestMethod] @@ -631,8 +631,8 @@ public void TestResultHandlerShouldNotShowformattedFailedTestsAndPassedTestsForO loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Passed", 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "(net451)"), OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, "Failed", 5, 1, 1, 1, "1 h 6 m", "TestSource", "(net451)"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Passed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", "(net451)"), OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Failed, 5, 1, 1, 1, "1 h 6 m", "TestSource", "(net451)"), OutputLevel.Information), Times.Never); } [TestMethod] From bf38a2e22824cbdec7e9b3eb681c746f5dd0a0b5 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 30 Oct 2019 19:05:29 +0530 Subject: [PATCH 14/28] summary added to verbosity minimal case also --- src/vstest.console/Internal/ConsoleLogger.cs | 6 +- .../Internal/ConsoleLoggerTests.cs | 57 ++++++++++++------- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index ec8b19770c..df871f8de9 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -232,7 +232,7 @@ public void Initialize(TestLoggerEvents events, Dictionary param bool.TryParse(noprogress, out DisableProgress); } - if (this.verbosityLevel == Verbosity.Quiet) + if (this.verbosityLevel == Verbosity.Quiet || this.verbosityLevel == Verbosity.Minimal) { this.targetFramework = parameters[DefaultLoggerParameterNames.TargetFramework]; this.targetFramework = !string.IsNullOrEmpty(this.targetFramework) ? NuGetFramework.Parse(this.targetFramework).GetShortFolderName() : this.targetFramework; @@ -652,7 +652,7 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) testsSkipped += summary.SkippedTests; testsTotal += summary.TotalTests; - if (verbosityLevel == Verbosity.Quiet) + if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) { var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); var resultString = summary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; @@ -662,7 +662,7 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } } - if (verbosityLevel == Verbosity.Quiet) + if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) { return; } diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 3f2e9b2a1b..957c2d2695 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -63,10 +63,14 @@ public void InitializeShouldNotThrowExceptionIfEventsIsNotNull() [TestMethod] public void InitializeWithParametersShouldThrowExceptionIfEventsIsNull() { + var parameters = new Dictionary + { + { "param1", "value" }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; + Assert.ThrowsException(() => { - var parameters = new Dictionary(); - parameters.Add("parma1", "value"); this.consoleLogger.Initialize(null, parameters); }); } @@ -92,8 +96,11 @@ public void InitializeWithParametersShouldThrowExceptionIfParametersIsNull() [TestMethod] public void InitializeWithParametersShouldSetVerbosityLevel() { - var parameters = new Dictionary(); - parameters.Add("verbosity", "minimal"); + var parameters = new Dictionary + { + { "verbosity", "minimal" }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; this.consoleLogger.Initialize(new Mock().Object, parameters); Assert.AreEqual(ConsoleLogger.Verbosity.Minimal, this.consoleLogger.VerbosityLevel); @@ -102,8 +109,12 @@ public void InitializeWithParametersShouldSetVerbosityLevel() [TestMethod] public void InitializeWithParametersShouldDefaultToNormalVerbosityLevelForInvalidVerbosity() { - var parameters = new Dictionary(); - parameters.Add("verbosity", "random"); + var parameters = new Dictionary + { + { "verbosity", "" }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; + this.consoleLogger.Initialize(new Mock().Object, parameters); #if NET451 @@ -116,26 +127,29 @@ public void InitializeWithParametersShouldDefaultToNormalVerbosityLevelForInvali [TestMethod] public void InitializeWithParametersShouldSetPrefixValue() { - var parameters = new Dictionary(); - + var parameters = new Dictionary + { + { "prefix", "true" }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; Assert.IsFalse(ConsoleLogger.AppendPrefix); - parameters.Add("prefix", "true"); this.consoleLogger.Initialize(new Mock().Object, parameters); Assert.IsTrue(ConsoleLogger.AppendPrefix); - ConsoleLogger.AppendPrefix = false; } [TestMethod] public void InitializeWithParametersShouldSetNoProgress() { - var parameters = new Dictionary(); + var parameters = new Dictionary + { + { "noprogress", "true" }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; Assert.IsFalse(ConsoleLogger.DisableProgress); - - parameters.Add("noprogress", "true"); this.consoleLogger.Initialize(new Mock().Object, parameters); Assert.IsTrue(ConsoleLogger.DisableProgress); @@ -573,16 +587,18 @@ public void TestResultHandlerShouldShowPassedTestsForNormalVebosity() this.mockProgressIndicator.Verify(pi => pi.Start(), Times.Exactly(5)); } - [DataRow(".NETFramework,version=v4.5.1", "(net451)")] - [DataRow(null, null)] + [DataRow(".NETFramework,version=v4.5.1", "(net451)", "quiet")] + [DataRow(".NETFramework,version=v4.5.1", "(net451)", "minimal")] + [DataRow(null, null, "quiet")] + [DataRow(null, null, "minimal")] [TestMethod] - public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity(string framework, string expectedFramework) + public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity(string framework, string expectedFramework, string verbosityLevel) { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); var parameters = new Dictionary { - { "verbosity", "quiet" }, + { "verbosity", verbosityLevel }, { DefaultLoggerParameterNames.TargetFramework , framework} }; this.consoleLogger.Initialize(loggerEvents, parameters); @@ -690,8 +706,11 @@ public void TestResultHandlerShouldWriteToConsoleButSkipPassedTestsForMinimalVer { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); - var parameters = new Dictionary(); - parameters.Add("verbosity", "minimal"); + var parameters = new Dictionary + { + { "verbosity", "minimal" }, + { DefaultLoggerParameterNames.TargetFramework , "net451"} + }; this.consoleLogger.Initialize(loggerEvents, parameters); foreach (var testResult in this.GetTestResultsObject()) From c16c6531b0bf2a36fafd7a828e3746d17bdd84f6 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 1 Nov 2019 12:41:56 +0530 Subject: [PATCH 15/28] attachments added to minimal and quiet verbosity case --- src/vstest.console/Internal/ConsoleLogger.cs | 75 +++++++++---------- .../Internal/ConsoleLoggerTests.cs | 19 ++--- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index df871f8de9..31349111a6 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -232,11 +232,8 @@ public void Initialize(TestLoggerEvents events, Dictionary param bool.TryParse(noprogress, out DisableProgress); } - if (this.verbosityLevel == Verbosity.Quiet || this.verbosityLevel == Verbosity.Minimal) - { - this.targetFramework = parameters[DefaultLoggerParameterNames.TargetFramework]; - this.targetFramework = !string.IsNullOrEmpty(this.targetFramework) ? NuGetFramework.Parse(this.targetFramework).GetShortFolderName() : this.targetFramework; - } + var noFrameworkExists = parameters.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out this.targetFramework); + this.targetFramework = !string.IsNullOrEmpty(this.targetFramework) ? NuGetFramework.Parse(this.targetFramework).GetShortFolderName() : this.targetFramework; Initialize(events, String.Empty); } @@ -638,19 +635,34 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { // Stop the progress indicator as we are about to print the summary this.progressIndicator?.Stop(); - var testsPassed = 0; - var testsFailed = 0; - var testsSkipped = 0; - var testsTotal = 0; + var passedTests = 0; + var failedTests = 0; + var skippedTests = 0; + var totalTests = 0; Output.WriteLine(string.Empty, OutputLevel.Information); + // Printing Run-level Attachments + var runLevelAttachementCount = (e.AttachmentSets == null) ? 0 : e.AttachmentSets.Sum(attachmentSet => attachmentSet.Attachments.Count); + if (runLevelAttachementCount > 0) + { + Output.Information(false, CommandLineResources.AttachmentsBanner); + foreach (var attachmentSet in e.AttachmentSets) + { + foreach (var uriDataAttachment in attachmentSet.Attachments) + { + var attachmentOutput = string.Format(CultureInfo.CurrentCulture, CommandLineResources.AttachmentOutputFormat, uriDataAttachment.Uri.LocalPath); + Output.Information(false, attachmentOutput); + } + } + } + foreach (var sd in this.sourceSummaryDictionary.ToArray()) { var summary = this.sourceSummaryDictionary[sd.Key]; - testsPassed += summary.PassedTests; - testsFailed += summary.FailedTests; - testsSkipped += summary.SkippedTests; - testsTotal += summary.TotalTests; + passedTests += summary.PassedTests; + failedTests += summary.FailedTests; + skippedTests += summary.SkippedTests; + totalTests += summary.TotalTests; if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) { @@ -667,21 +679,6 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) return; } - // Printing Run-level Attachments - var runLevelAttachementCount = (e.AttachmentSets == null) ? 0 : e.AttachmentSets.Sum(attachmentSet => attachmentSet.Attachments.Count); - if (runLevelAttachementCount > 0) - { - Output.Information(false, CommandLineResources.AttachmentsBanner); - foreach (var attachmentSet in e.AttachmentSets) - { - foreach (var uriDataAttachment in attachmentSet.Attachments) - { - var attachmentOutput = string.Format(CultureInfo.CurrentCulture, CommandLineResources.AttachmentOutputFormat, uriDataAttachment.Uri.LocalPath); - Output.Information(false, attachmentOutput); - } - } - } - if (e.IsCanceled) { Output.Error(false, CommandLineResources.TestRunCanceled); @@ -690,36 +687,36 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { Output.Error(false, CommandLineResources.TestRunAborted); } - else if (testsFailed > 0 || this.testRunHasErrorMessages) + else if (failedTests > 0 || this.testRunHasErrorMessages) { Output.Error(false, CommandLineResources.TestRunFailed); } - else if (testsTotal > 0) + else if (totalTests > 0) { Output.Information(false, ConsoleColor.Green, CommandLineResources.TestRunSuccessful); } // Output a summary. - if (testsTotal > 0) + if (totalTests > 0) { string totalTestsformat = (e.IsAborted || e.IsCanceled) ? CommandLineResources.TestRunSummaryForCanceledOrAbortedRun : CommandLineResources.TestRunSummaryTotalTests; - Output.Information(false, string.Format(CultureInfo.CurrentCulture, totalTestsformat, testsTotal)); + Output.Information(false, string.Format(CultureInfo.CurrentCulture, totalTestsformat, totalTests)); - if (testsPassed > 0) + if (passedTests > 0) { - Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, testsPassed)); + Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests)); } - if (testsFailed > 0) + if (failedTests > 0) { - Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, testsFailed)); + Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests)); } - if (testsSkipped > 0) + if (skippedTests > 0) { - Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, testsSkipped)); + Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests)); } } - if (testsTotal > 0) + if (totalTests > 0) { if (e.ElapsedTimeInRunningTests.Equals(TimeSpan.Zero)) { diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 957c2d2695..4c4c0bef55 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -66,7 +66,6 @@ public void InitializeWithParametersShouldThrowExceptionIfEventsIsNull() var parameters = new Dictionary { { "param1", "value" }, - { DefaultLoggerParameterNames.TargetFramework , "net451"} }; Assert.ThrowsException(() => @@ -112,7 +111,6 @@ public void InitializeWithParametersShouldDefaultToNormalVerbosityLevelForInvali var parameters = new Dictionary { { "verbosity", "" }, - { DefaultLoggerParameterNames.TargetFramework , "net451"} }; this.consoleLogger.Initialize(new Mock().Object, parameters); @@ -130,7 +128,6 @@ public void InitializeWithParametersShouldSetPrefixValue() var parameters = new Dictionary { { "prefix", "true" }, - { DefaultLoggerParameterNames.TargetFramework , "net451"} }; Assert.IsFalse(ConsoleLogger.AppendPrefix); @@ -143,17 +140,13 @@ public void InitializeWithParametersShouldSetPrefixValue() [TestMethod] public void InitializeWithParametersShouldSetNoProgress() { - var parameters = new Dictionary - { - { "noprogress", "true" }, - { DefaultLoggerParameterNames.TargetFramework , "net451"} - }; + var parameters = new Dictionary(); + parameters.Add("noprogress", "true"); Assert.IsFalse(ConsoleLogger.DisableProgress); this.consoleLogger.Initialize(new Mock().Object, parameters); Assert.IsTrue(ConsoleLogger.DisableProgress); - ConsoleLogger.DisableProgress = false; } @@ -1107,13 +1100,17 @@ public void GetTestMessagesShouldWriteMessageAndStackTraceToConsole() this.mockOutput.Verify(o => o.WriteLine(" AdditionalInfoCategory AnotherAdditionalInfoCategory", OutputLevel.Information), Times.Once()); } + [DataRow("quiet")] + [DataRow("Normal")] + [DataRow("minimal")] + [DataRow("detailed")] [TestMethod] - public void AttachmentInformationShouldBeWrittenToConsoleIfAttachmentsArePresent() + public void AttachmentInformationShouldBeWrittenToConsoleIfAttachmentsArePresent(string verbosityLevel) { var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); loggerEvents.EnableEvents(); var parameters = new Dictionary(); - parameters.Add("verbosity", "normal"); + parameters.Add("verbosity", verbosityLevel); this.consoleLogger.Initialize(loggerEvents, parameters); var attachmentSet = new AttachmentSet(new Uri("test://uri"), "myattachmentset"); From 5075c6be53e7e6466bf5f3f14a5844a24e7603cf Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 15 Nov 2019 19:40:42 +0530 Subject: [PATCH 16/28] formatted --- src/vstest.console/Internal/ConsoleLogger.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 31349111a6..48564b50cb 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -157,7 +157,7 @@ protected static IOutput Output public Verbosity VerbosityLevel => verbosityLevel; /// - /// Dictionary of summary of each source. + /// Source level summary of test result. /// private ConcurrentDictionary sourceSummaryDictionary { get; set; } @@ -232,7 +232,7 @@ public void Initialize(TestLoggerEvents events, Dictionary param bool.TryParse(noprogress, out DisableProgress); } - var noFrameworkExists = parameters.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out this.targetFramework); + parameters.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out this.targetFramework); this.targetFramework = !string.IsNullOrEmpty(this.targetFramework) ? NuGetFramework.Parse(this.targetFramework).GetShortFolderName() : this.targetFramework; Initialize(events, String.Empty); From a7427469b3b1a59ca7652c08e76a97c634bfcd2a Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 19 Nov 2019 15:55:17 +0530 Subject: [PATCH 17/28] removed milliseconds unit when seconds unit is there --- src/vstest.console/Internal/ConsoleLogger.cs | 2 +- test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 83793e683d..d393f7fccf 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -619,7 +619,7 @@ private string GetFormattedDurationString(TimeSpan duration) time.Add(duration.Seconds + " s"); } - if (duration.Milliseconds > 0 && duration.Minutes == 0) + if (duration.Milliseconds > 0 && duration.Minutes == 0 && duration.Seconds == 0) { time.Add(duration.Milliseconds + " ms"); } diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 2c8b25aa71..45f2a624b3 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -748,10 +748,11 @@ public void TestResultHandlerShouldWriteToNoTestResultForQuietVerbosity() [DataRow("[1 h 2 m]", new int[5] { 0, 1, 2, 3, 78 })] [DataRow("[4 m 3 s]", new int[5] { 0, 0, 4, 3, 78 })] - [DataRow("[3 s 78 ms]", new int[5] { 0, 0, 0, 3, 78 })] + [DataRow("[3 s]", new int[5] { 0, 0, 0, 3, 78 })] [DataRow("[78 ms]", new int[5] { 0, 0, 0, 0, 78 })] [DataRow("[1 h]", new int[5] { 0, 1, 0, 5, 78 })] [DataRow("[5 m]", new int[5] { 0, 0, 5, 0, 78 })] + [DataRow("[4 s]", new int[5] { 0, 0, 0, 4, 0 })] [DataTestMethod] public void TestResultHandlerForTestResultWithDurationShouldPrintDurationInfo(string expectedDuration, int[] timeSpanArgs) { From 18c40228cb5e975a53fbfa04ec99d5ffaca4afce Mon Sep 17 00:00:00 2001 From: nohwnd Date: Wed, 8 Jan 2020 16:43:41 +0100 Subject: [PATCH 18/28] Forward merge master --- TestPlatform.sln | 34 ++++- scripts/build.ps1 | 27 +++- scripts/build.sh | 2 +- scripts/build/TestPlatform.Settings.targets | 2 +- .../Microsoft.TestPlatform.targets | 2 +- .../TestExtensionPluginInformation.cs | 7 +- .../Resources/Resources.Designer.cs | 2 +- .../Resources/Resources.resx | 2 +- .../Resources/xlf/Resources.cs.xlf | 4 +- .../Resources/xlf/Resources.de.xlf | 4 +- .../Resources/xlf/Resources.es.xlf | 4 +- .../Resources/xlf/Resources.fr.xlf | 4 +- .../Resources/xlf/Resources.it.xlf | 4 +- .../Resources/xlf/Resources.ja.xlf | 4 +- .../Resources/xlf/Resources.ko.xlf | 4 +- .../Resources/xlf/Resources.pl.xlf | 4 +- .../Resources/xlf/Resources.pt-BR.xlf | 4 +- .../Resources/xlf/Resources.ru.xlf | 4 +- .../Resources/xlf/Resources.tr.xlf | 4 +- .../Resources/xlf/Resources.xlf | 2 +- .../Resources/xlf/Resources.zh-Hans.xlf | 6 +- .../Resources/xlf/Resources.zh-Hant.xlf | 4 +- .../RunSettingsProviderExtensions.cs | 84 +++++++++++- .../InProcDataCollectionExtensionManager.cs | 10 ++ .../DataCollection/InProcDataCollector.cs | 19 ++- .../Resources/xlf/Resources.cs.xlf | 6 +- .../Resources/xlf/Resources.de.xlf | 6 +- .../Resources/xlf/Resources.es.xlf | 6 +- .../Resources/xlf/Resources.fr.xlf | 6 +- .../Resources/xlf/Resources.it.xlf | 6 +- .../Resources/xlf/Resources.ja.xlf | 6 +- .../Resources/xlf/Resources.ko.xlf | 6 +- .../Resources/xlf/Resources.pl.xlf | 6 +- .../Resources/xlf/Resources.pt-BR.xlf | 6 +- .../Resources/xlf/Resources.ru.xlf | 6 +- .../Resources/xlf/Resources.tr.xlf | 6 +- .../Resources/xlf/Resources.zh-Hans.xlf | 6 +- .../Resources/xlf/Resources.zh-Hant.xlf | 6 +- .../Utility/Converter.cs | 3 +- .../Constants.cs | 3 + .../Hosting/DotnetTestHostManager.cs | 9 +- src/package/VSIXProject/TestPlatform.csproj | 2 +- src/vstest.console/Internal/ConsoleLogger.cs | 122 ++++++++++++++---- .../CLIRunSettingsArgumentProcessor.cs | 38 +++++- .../Resources/Resources.Designer.cs | 11 +- src/vstest.console/Resources/Resources.resx | 4 + .../Resources/xlf/Resources.cs.xlf | 7 + .../Resources/xlf/Resources.de.xlf | 7 + .../Resources/xlf/Resources.es.xlf | 7 + .../Resources/xlf/Resources.fr.xlf | 13 +- .../Resources/xlf/Resources.it.xlf | 7 + .../Resources/xlf/Resources.ja.xlf | 7 + .../Resources/xlf/Resources.ko.xlf | 7 + .../Resources/xlf/Resources.pl.xlf | 7 + .../Resources/xlf/Resources.pt-BR.xlf | 7 + .../Resources/xlf/Resources.ru.xlf | 7 + .../Resources/xlf/Resources.tr.xlf | 7 + .../Resources/xlf/Resources.xlf | 7 + .../Resources/xlf/Resources.zh-Hans.xlf | 20 ++- .../Resources/xlf/Resources.zh-Hant.xlf | 7 + .../OrderedTests.cs | 2 +- .../RunsettingsTests.cs | 31 +++++ .../RunSettingsProviderExtensionsTests.cs | 33 ++++- .../InProcDataCollectorTests.cs | 25 +++- ...tPlatform.CrossPlatEngine.UnitTests.csproj | 1 + .../Utility/ConverterTests.cs | 3 +- .../Hosting/DotnetTestHostManagerTests.cs | 17 ++- .../IntegrationTestBase.cs | 114 ++++++++++++---- .../IntegrationTestEnvironment.cs | 35 +++++ .../ProjectFileRunSettingsTestProject.csproj | 31 +++++ .../UnitTest1.cs | 20 +++ .../fail.runsettings | 6 + .../inconclusive.runsettings | 6 + test/TestAssets/TestAssets.sln/TestAssets.sln | 8 +- .../CoverletInProcDataCollector.cs | 46 +++++++ .../coverlet.collector.csproj | 12 ++ test/TestAssets/coverlet.collector/key.snk | Bin 0 -> 596 bytes .../Internal/ConsoleLoggerTests.cs | 45 +++++++ .../CLIRunSettingsArgumentProcessorTests.cs | 90 +++++++++++++ 79 files changed, 991 insertions(+), 168 deletions(-) create mode 100644 test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj create mode 100644 test/TestAssets/ProjectFileRunSettingsTestProject/UnitTest1.cs create mode 100644 test/TestAssets/ProjectFileRunSettingsTestProject/fail.runsettings create mode 100644 test/TestAssets/ProjectFileRunSettingsTestProject/inconclusive.runsettings create mode 100644 test/TestAssets/coverlet.collector/CoverletInProcDataCollector.cs create mode 100644 test/TestAssets/coverlet.collector/coverlet.collector.csproj create mode 100644 test/TestAssets/coverlet.collector/key.snk diff --git a/TestPlatform.sln b/TestPlatform.sln index 2e140d8990..b592e87249 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.779 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29319.158 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED0C35EB-7F31-4841-A24F-8EB708FFA959}" EndProject @@ -179,6 +179,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Exte EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests", "test\Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests\Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj", "{41248B96-6E15-4E5E-A78F-859897676814}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.collector", "test\TestAssets\coverlet.collector\coverlet.collector.csproj", "{F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectFileRunSettingsTestProject", "test\TestAssets\ProjectFileRunSettingsTestProject\ProjectFileRunSettingsTestProject.csproj", "{8E87F6E4-E884-4404-B2E5-CBFB28038AE5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -897,6 +901,30 @@ Global {41248B96-6E15-4E5E-A78F-859897676814}.Release|x64.Build.0 = Release|Any CPU {41248B96-6E15-4E5E-A78F-859897676814}.Release|x86.ActiveCfg = Release|Any CPU {41248B96-6E15-4E5E-A78F-859897676814}.Release|x86.Build.0 = Release|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Debug|x64.ActiveCfg = Debug|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Debug|x64.Build.0 = Debug|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Debug|x86.ActiveCfg = Debug|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Debug|x86.Build.0 = Debug|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Release|Any CPU.Build.0 = Release|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Release|x64.ActiveCfg = Release|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Release|x64.Build.0 = Release|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Release|x86.ActiveCfg = Release|Any CPU + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3}.Release|x86.Build.0 = Release|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Debug|x64.ActiveCfg = Debug|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Debug|x64.Build.0 = Debug|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Debug|x86.ActiveCfg = Debug|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Debug|x86.Build.0 = Debug|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Release|Any CPU.Build.0 = Release|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Release|x64.ActiveCfg = Release|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Release|x64.Build.0 = Release|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Release|x86.ActiveCfg = Release|Any CPU + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -973,6 +1001,8 @@ Global {D16ACC60-52F8-4912-8870-5733A9F6852D} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} {236A71E3-01DA-4679-9DFF-16A8E079ACFF} = {5E7F18A8-F843-4C8A-AB02-4C7D9205C6CF} {41248B96-6E15-4E5E-A78F-859897676814} = {020E15EA-731F-4667-95AF-226671E0C3AE} + {F1D8630D-97D5-4CD7-BC18-A5E1779FA6E3} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} + {8E87F6E4-E884-4404-B2E5-CBFB28038AE5} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0541B30C-FF51-4E28-B172-83F5F3934BCD} diff --git a/scripts/build.ps1 b/scripts/build.ps1 index f71b0da3ac..a3b79daaa3 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -78,7 +78,7 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 # Dotnet build doesn't support --packages yet. See https://github.com/dotnet/cli/issues/2712 $env:NUGET_PACKAGES = $env:TP_PACKAGES_DIR $env:NUGET_EXE_Version = "3.4.3" -$env:DOTNET_CLI_VERSION = "LATEST" +$env:DOTNET_CLI_VERSION = "3.1.100-preview2-014569" # $env:DOTNET_RUNTIME_VERSION = "LATEST" $env:VSWHERE_VERSION = "2.0.2" $env:MSBUILD_VERSION = "15.0" @@ -213,6 +213,19 @@ function Invoke-Build Write-Log "Invoke-Build: Complete. {$(Get-ElapsedTime($timer))}" } +function Publish-PatchedDotnet { + Write-Log "Publish-PatchedDotnet: Copy local dotnet installation to testArtifacts" + $dotnetPath = "$env:TP_TOOLS_DIR\dotnet\" + + $dotnetTestArtifactsPath = "$env:TP_TESTARTIFACTS\dotnet\" + $dotnetTestArtifactsSdkPath = "$env:TP_TESTARTIFACTS\dotnet\sdk\$env:DOTNET_CLI_VERSION\" + Copy-Item $dotnetPath $dotnetTestArtifactsPath -Force -Recurse + + Write-Log "Publish-PatchedDotnet: Copy VSTest task artifacts to local dotnet installation to allow `dotnet test` to run with it" + $buildArtifactsPath = "$env:TP_ROOT_DIR\src\Microsoft.TestPlatform.Build\bin\$TPB_Configuration\$TPB_TargetFrameworkNS2_0\*" + Copy-Item $buildArtifactsPath $dotnetTestArtifactsSdkPath -Force +} + function Publish-Package { $timer = Start-Timer @@ -685,8 +698,8 @@ function Update-LocalizedResources } $localizationProject = Join-Path $env:TP_PACKAGE_PROJ_DIR "Localize\Localize.proj" - Write-Verbose "& $dotnetExe msbuild $localizationProject -m -nologo -v:minimal -t:Localize -p:LocalizeResources=true" - & $dotnetExe msbuild $localizationProject -m -nologo -v:minimal -t:Localize -p:LocalizeResources=true + Write-Verbose "& $dotnetExe msbuild $localizationProject -m -nologo -v:minimal -t:Localize -p:LocalizeResources=true -nodeReuse:False" + & $dotnetExe msbuild $localizationProject -m -nologo -v:minimal -t:Localize -p:LocalizeResources=true -nodeReuse:False Set-ScriptFailedOnError @@ -783,13 +796,13 @@ function Locate-VsInstallPath Try { - Write-Verbose "VSWhere command line: $vswhere -latest -prerelease -products * -requires $requiredPackageIds -property installationPath" + Write-Verbose "VSWhere command line: $vswhere -version '(15.0,16.0]' -prerelease -products * -requires $requiredPackageIds -property installationPath" if ($TPB_CIBuild) { - $vsInstallPath = & $vswhere -latest -products * -requires $requiredPackageIds -property installationPath + $vsInstallPath = & $vswhere -version '(15.0,16.0]' -products * -requires $requiredPackageIds -property installationPath } else { # Allow using pre release versions of VS for dev builds - $vsInstallPath = & $vswhere -latest -prerelease -products * -requires $requiredPackageIds -property installationPath + $vsInstallPath = & $vswhere -version '(15.0,16.0]' -prerelease -products * -requires $requiredPackageIds -property installationPath } } Catch [System.Management.Automation.MethodInvocationException] @@ -901,9 +914,11 @@ Restore-Package Update-LocalizedResources Invoke-Build Publish-Package +Publish-PatchedDotnet Publish-Tests Create-VsixPackage Create-NugetPackages Generate-Manifest Write-Log "Build complete. {$(Get-ElapsedTime($timer))}" if ($Script:ScriptFailed) { Exit 1 } else { Exit 0 } + \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 2a04c38732..e27183e4ce 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -111,7 +111,7 @@ VERSION=$(test -z $VERSION && grep TPVersionPrefix $TP_ROOT_DIR/scripts/build/Te export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Dotnet build doesnt support --packages yet. See https://github.com/dotnet/cli/issues/2712 export NUGET_PACKAGES=$TP_PACKAGES_DIR -DOTNET_CLI_VERSION="LATEST" +DOTNET_CLI_VERSION="3.1.100-preview2-014569" #DOTNET_RUNTIME_VERSION="LATEST" # diff --git a/scripts/build/TestPlatform.Settings.targets b/scripts/build/TestPlatform.Settings.targets index d74b8914aa..f53e540520 100644 --- a/scripts/build/TestPlatform.Settings.targets +++ b/scripts/build/TestPlatform.Settings.targets @@ -2,7 +2,7 @@ $(MSBuildThisFileDirectory)../../ - 16.4.0 + 16.5.0 $(NoWarn);2008 diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index d393f7fccf..5ced548bb9 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -85,6 +85,16 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// public const string ProgressIndicatorParam = "progress"; + /// + /// Property Id storing the ParentExecutionId. + /// + public const string ParentExecutionIdPropertyIdentifier = "ParentExecId"; + + /// + /// Property Id storing the ExecutionId. + /// + public const string ExecutionIdPropertyIdentifier = "ExecutionId"; + #endregion internal enum Verbosity @@ -157,9 +167,10 @@ protected static IOutput Output public Verbosity VerbosityLevel => verbosityLevel; /// - /// Source level summary of test result. + /// Tracks leaf test outcomes per source. This is needed to correctly count hierarchical tests as well as + /// tracking counts per source for the minimal and quiet output. /// - private ConcurrentDictionary sourceSummaryDictionary { get; set; } + private ConcurrentDictionary> leafTestOutcomesPerSource { get; set; } #endregion @@ -196,7 +207,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Register for the discovery events. events.DiscoveryMessage += this.TestMessageHandler; - this.sourceSummaryDictionary = new ConcurrentDictionary(); + this.leafTestOutcomesPerSource = new ConcurrentDictionary>(); // TODO Get changes from https://github.com/Microsoft/vstest/pull/1111/ // events.DiscoveredTests += DiscoveredTestsHandler; @@ -381,6 +392,39 @@ private static void DisplayFullInformation(TestResult result) } } + /// + /// Returns the parent Execution id of given test result. + /// + /// + /// + private Guid GetParentExecutionId(TestResult testResult) + { + var parentExecutionIdProperty = testResult.Properties.FirstOrDefault(property => + property.Id.Equals(ParentExecutionIdPropertyIdentifier)); + return parentExecutionIdProperty == null + ? Guid.Empty + : testResult.GetPropertyValue(parentExecutionIdProperty, Guid.Empty); + } + + /// + /// Returns execution id of given test result + /// + /// + /// + private Guid GetExecutionId(TestResult testResult) + { + var executionIdProperty = testResult.Properties.FirstOrDefault(property => + property.Id.Equals(ExecutionIdPropertyIdentifier)); + var executionId = Guid.Empty; + + if (executionIdProperty != null) + { + executionId = testResult.GetPropertyValue(executionIdProperty, Guid.Empty); + } + + return executionId.Equals(Guid.Empty) ? Guid.NewGuid() : executionId; + } + #endregion #region Event Handlers @@ -477,16 +521,13 @@ private void TestResultHandler(object sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - SourceSummary summary; - if (!this.sourceSummaryDictionary.TryGetValue(e.Result.TestCase.Source, out summary)) + ConcurrentDictionary leafTestOutcomes; + if (!this.leafTestOutcomesPerSource.TryGetValue(e.Result.TestCase.Source, out leafTestOutcomes)) { - summary = new SourceSummary(); - this.sourceSummaryDictionary.TryAdd(e.Result.TestCase.Source, summary); + leafTestOutcomes = new ConcurrentDictionary(); + this.leafTestOutcomesPerSource.TryAdd(e.Result.TestCase.Source, leafTestOutcomes); } - // Update the test count statistics based on the result of the test. - summary.TotalTests++; - summary.Duration += e.Result.Duration; var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) @@ -500,11 +541,20 @@ private void TestResultHandler(object sender, TestResultEventArgs e) testDisplayName = string.Format("{0} [{1}]", testDisplayName, formattedDuration); } + var executionId = GetExecutionId(e.Result); + var parentExecutionId = GetParentExecutionId(e.Result); + + if (parentExecutionId != Guid.Empty && leafTestOutcomes.ContainsKey(parentExecutionId)) + { + leafTestOutcomes.TryRemove(parentExecutionId, out _); + } + + leafTestOutcomes.TryAdd(executionId, e.Result); + switch (e.Result.Outcome) { case TestOutcome.Skipped: { - summary.SkippedTests++; if (this.verbosityLevel == Verbosity.Quiet) { break; @@ -528,7 +578,6 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Failed: { - summary.FailedTests++; if (this.verbosityLevel == Verbosity.Quiet) { break; @@ -549,7 +598,6 @@ private void TestResultHandler(object sender, TestResultEventArgs e) case TestOutcome.Passed: { - summary.PassedTests++; if (this.verbosityLevel == Verbosity.Normal || this.verbosityLevel == Verbosity.Detailed) { // Pause the progress indicator before displaying test result information @@ -619,7 +667,7 @@ private string GetFormattedDurationString(TimeSpan duration) time.Add(duration.Seconds + " s"); } - if (duration.Milliseconds > 0 && duration.Minutes == 0 && duration.Seconds == 0) + if (duration.Milliseconds > 0 && duration.Minutes == 0 && duration.Seconds == 0) { time.Add(duration.Milliseconds + " ms"); } @@ -656,22 +704,44 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } } - foreach (var sd in this.sourceSummaryDictionary.ToArray()) + foreach (var sd in this.leafTestOutcomesPerSource) { - var summary = this.sourceSummaryDictionary[sd.Key]; - passedTests += summary.PassedTests; - failedTests += summary.FailedTests; - skippedTests += summary.SkippedTests; - totalTests += summary.TotalTests; + var source = sd.Value; + var sourceSummary = new SourceSummary(); - if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) + foreach (var result in source.Values) { - var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); - var resultString = summary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; - var color = summary.FailedTests > 0 ? ConsoleColor.Red : summary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; - var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString, summary.TotalTests, summary.PassedTests, summary.FailedTests, summary.SkippedTests, GetFormattedDurationString(summary.Duration), sd.Key.Split('\\').Last(), frameworkString); - Output.Information(false, color, outputLine); + sourceSummary.Duration += result.Duration; + sourceSummary.TotalTests++; + switch (result.Outcome) + { + case TestOutcome.Passed: + sourceSummary.PassedTests++; + break; + case TestOutcome.Failed: + sourceSummary.FailedTests++; + break; + case TestOutcome.Skipped: + sourceSummary.SkippedTests++; + break; + default: + break; + } + + if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) + { + var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); + var resultString = sourceSummary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; + var color = sourceSummary.FailedTests > 0 ? ConsoleColor.Red : sourceSummary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; + var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString, sourceSummary.TotalTests, sourceSummary.PassedTests, sourceSummary.FailedTests, sourceSummary.SkippedTests, GetFormattedDurationString(sourceSummary.Duration), sd.Key.Split('\\').Last(), frameworkString); + Output.Information(false, color, outputLine); + } } + + passedTests += sourceSummary.PassedTests; + failedTests += sourceSummary.FailedTests; + skippedTests += sourceSummary.SkippedTests; + totalTests += sourceSummary.TotalTests; } if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) diff --git a/src/vstest.console/Processors/CLIRunSettingsArgumentProcessor.cs b/src/vstest.console/Processors/CLIRunSettingsArgumentProcessor.cs index 2dcc983da4..c27853c619 100644 --- a/src/vstest.console/Processors/CLIRunSettingsArgumentProcessor.cs +++ b/src/vstest.console/Processors/CLIRunSettingsArgumentProcessor.cs @@ -13,6 +13,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors using Microsoft.VisualStudio.TestPlatform.Common.Utilities; using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + using System.Text.RegularExpressions; /// /// The argument processor for runsettings passed as argument through cli @@ -139,14 +140,22 @@ private void CreateOrOverwriteRunSettings(IRunSettingsProvider runSettingsProvid for (int index = 0; index < length; index++) { - var keyValuePair = args[index]; - var indexOfSeparator = keyValuePair.IndexOf("="); - if (indexOfSeparator <= 0 || indexOfSeparator >= keyValuePair.Length - 1) + var arg = args[index]; + + if (UpdateTestRunParameterNode(runSettingsProvider, arg)) { continue; } - var key = keyValuePair.Substring(0, indexOfSeparator).Trim(); - var value = keyValuePair.Substring(indexOfSeparator + 1); + + var indexOfSeparator = arg.IndexOf("="); + + if (indexOfSeparator <= 0 || indexOfSeparator >= arg.Length - 1) + { + continue; + } + + var key = arg.Substring(0, indexOfSeparator).Trim(); + var value = arg.Substring(indexOfSeparator + 1); if (string.IsNullOrWhiteSpace(key)) { @@ -160,6 +169,25 @@ private void CreateOrOverwriteRunSettings(IRunSettingsProvider runSettingsProvid } } + private bool UpdateTestRunParameterNode(IRunSettingsProvider runSettingsProvider, string node) + { + if (!node.Contains(Constants.TestRunParametersName)) + { + return false; + } + + var match = runSettingsProvider.GetTestRunParameterNodeMatch(node); + + if (string.Compare(match.Value, node) == 0) + { + runSettingsProvider.UpdateTestRunParameterSettingsNode(match); + return true; + } + + var exceptionMessage = string.Format(CommandLineResources.InvalidTestRunParameterArgument, node); + throw new CommandLineException(exceptionMessage); + } + private void UpdateFrameworkAndPlatform(string key, string value) { if (key.Equals(FrameworkArgumentExecutor.RunSettingsPath)) diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 25e426358d..28fc8216f3 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -13,7 +13,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Resources using System; using System.Reflection; - /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -835,6 +834,16 @@ internal static string InvalidTestCaseFilterValueForSpecificTests { } } + /// + /// Looks up a localized string similar to The test run parameter argument '{0}' is invalid. Please use the format below. + /// Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\"). + /// + internal static string InvalidTestRunParameterArgument { + get { + return ResourceManager.GetString("InvalidTestRunParameterArgument", resourceCulture); + } + } + /// /// Looks up a localized string similar to Argument {0} is not expected in the 'UseVsixExtensions' command. Specify the command indicating whether the vsix extensions should be used or skipped (Example: vstest.console.exe myTests.dll /UseVsixExtensions:true) and try again.. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 7a0b02851b..7f920234dd 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -743,4 +743,8 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index ee46fce024..78ba78701e 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 084a5d7600..21cd8fd0e6 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index b83fc0e50b..49dc295581 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1674,6 +1674,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 4ba849386c..89ad645728 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -221,7 +221,7 @@ fichier de résultats des tests Visual Studio (TRX), utilisez /logger:trx[;LogFileName=<nom de fichier unique par défaut>] Crée un fichier dans le répertoire TestResults avec le LogFileName indiqué. - Change le niveau de détail des messages du journaliseur de la console, comme indiqué ci-dessous + Change le niveau de verbosité des messages du journaliseur de la console, comme indiqué ci-dessous Exemple : /logger:console;verbosity=<"normal" par défaut> Valeurs autorisées pour verbosity : quiet, minimal, normal et detailed. @@ -297,7 +297,7 @@ testproject*.dll my*project.dll [TestFileNames] Exécutez des tests à partir des fichiers ou des modèles de caractères génériques spécifiés. Séparez plusieurs modèles ou noms de fichiers de test - par des espaces. Affectez au journaliseur de console un niveau de détail élevé pour voir les fichiers de test correspondants. + par des espaces. Affectez à la verbosité du journaliseur de console la valeur Detailed pour voir les fichiers de test correspondants. Exemples : mytestproject.dll mytestproject.dll myothertestproject.exe testproject*.dll my*project.dll @@ -1577,7 +1577,7 @@ fichier de résultats des tests Visual Studio (TRX), utilisez /logger:trx[;LogFileName=<nom de fichier unique par défaut>] Crée un fichier dans le répertoire TestResults avec le LogFileName indiqué. - Change le niveau de détail des messages du journaliseur de la console, comme indiqué ci-dessous + Change le niveau de verbosité des messages du journaliseur de la console, comme indiqué ci-dessous Exemple : /logger:console;verbosity=<"minimal" par défaut> Valeurs autorisées pour verbosity : quiet, minimal, normal et detailed. @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 84bd80a6eb..e901acdd05 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 32891cd692..91757b7361 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 6f9712a9f5..321ec6e819 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index d74fefae12..a049e1a6a5 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index f07d677e79..b54d1e306c 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1671,6 +1671,13 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 8048350937..f753f44b6d 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1671,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 65a3deb04d..bac67721f5 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1671,6 +1671,13 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 0dfb1ec3a7..892be943d3 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -862,6 +862,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 0751be05cf..2ee31792d0 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -217,12 +217,13 @@ Example: /logger:console;prefix=<Defaults to "false"> More info on Console Logger here : https://aka.ms/console-logger --logger|/logger:<Logger Uri/FriendlyName> - 为测试结果指定一个记录器。例如,若要将结果记录到 Visual Studio 测试结果文件(TRX)中,请使用/logger:trx[;LogFileName=<Defaults to unique file name>] + 为测试结果指定一个记录器。例如,若要将结果记录到 + Visual Studio 测试结果文件(TRX)中,请使用/logger:trx[;LogFileName=<Defaults to unique file name>] 使用给定的 LogFileName 在 TestResults 目录中创建文件。 - 更改控制台记录器的日志消息中的详细级别,如下所示 + 更改控制台记录器的日志消息中的详细程度,如下所示 示例: /logger:console;verbosity<Defaults to "normal"> - 允许的详细级别的值: quiet、minimal、normal 和 detailed。 + 允许的详细程度的值: quiet、minimal、normal 和 detailed。 更改控制台记录器的诊断级别前缀,如下所示 示例: /logger:console;prefix=<Defaults to "false"> @@ -296,7 +297,7 @@ testproject*.dll my*project.dll [TestFileNames] 从指定的文件或通配符模式运行测试。通过空格将多个测试文件或模式分隔开来。 - 将控制台记录器详细级别设置为“详细”以查看匹配的测试文件。 + 将控制台记录器详细程度设置为“详细”以查看匹配的测试文件。 示例: mytestproject.dll mytestproject.dll myothertestproject.exe testproject*.dll my*project.dll @@ -1576,9 +1577,9 @@ Visual Studio 测试结果文件(TRX)中,请使用 /logger:trx[;LogFileName=<Defaults to unique file name>] 使用给定的 LogFileName 在 TestResults 目录中创建文件。 - 更改控制台记录器的日志消息中的详细级别,如下所示 + 更改控制台记录器的日志消息中的详细程度,如下所示 示例: /logger:console;verbosity=<Defaults to "minimal"> - 允许的详细级别的值: quiet、minimal、normal 和 detailed。 + 允许的详细程度的值: quiet、minimal、normal 和 detailed。 更改控制台记录器的诊断级别前缀,如下所示 示例: /logger:console;prefix=<Defaults to "false"> @@ -1670,6 +1671,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 859d397741..622bedb1cb 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1672,6 +1672,13 @@ Passed + + The test run parameter argument '{0}' is invalid. Please use the format below. + Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + The test run parameter argument '{0}' is invalid. Please use the format below. +Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/OrderedTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/OrderedTests.cs index b9e6f82917..533b64989e 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/OrderedTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/OrderedTests.cs @@ -49,7 +49,7 @@ public void OlderOrderedTestsShouldWorkFine(RunnerInfo runnerInfo) this.ValidateFailedTests("FailingTest1"); this.ValidateSkippedTests("FailingTest2"); // Parent test result should fail as inner results contain failing test. - this.ValidateSummaryStatus(2, 2, 1); + this.ValidateSummaryStatus(2, 1, 1); } } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs index ac66c63dda..8066cd512e 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs @@ -478,6 +478,37 @@ public void EnvironmentVariablesSettingsShouldSetEnvironmentVariables(RunnerInfo #endregion + #region RunSettings defined in project file + /// + /// RunSettingsFilePath can be specified in .csproj and should be honored by `dotnet test`, this test + /// checks that the settings were honored by translating an inconlusive test to failed "result", instead of the default "skipped". + /// This test depends on Microsoft.TestPlatform.Build\Microsoft.TestPlatform.targets being previously copied into the + /// artifacts/testArtifacts/dotnet folder. This will allow the local copy of dotnet to pickup the VSTest msbuild task. + /// + /// + [TestMethod] + [NetFullTargetFrameworkDataSource] + [NetCoreTargetFrameworkDataSource] + public void RunSettingsAreLoadedFromProject(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + + var projectName = "ProjectFileRunSettingsTestProject.csproj"; + var projectPath = this.GetProjectFullPath(projectName); + this.InvokeDotnetTest(projectPath); + this.ValidateSummaryStatus(0, 1, 0); + + // make sure that we can revert the project settings back by providing a config from commandline + // keeping this in the same test, because it is easier to see that we are reverting settings that + // are honored by dotnet test, instead of just using the default, which would produce the same + // result + var settingsPath = this.GetProjectAssetFullPath(projectName, "inconclusive.runsettings"); + this.InvokeDotnetTest($"{projectPath} --settings {settingsPath}"); + this.ValidateSummaryStatus(0, 0, 1); + } + + #endregion + private string GetRunsettingsFilePath(Dictionary runConfigurationDictionary) { var runsettingsPath = Path.Combine( diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs index 8083c71a57..82e834be78 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs @@ -4,13 +4,14 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors.Utilities { using System; - + using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Common.Utilities; + using System.Text.RegularExpressions; [TestClass] public class RunSettingsProviderExtensionsTests @@ -24,7 +25,7 @@ public void Init() { runSettingsProvider = new TestableRunSettingsProvider(); } - + [TestMethod] public void UpdateRunSettingsShouldUpdateGivenSettingsXml() { @@ -130,6 +131,31 @@ public void UpdateRunSettingsNodeShouldAddNewKeyIfNotPresent() Assert.AreEqual("data", this.runSettingsProvider.QueryRunSettingsNode("Key.Path")); } + [TestMethod] + public void UpdateTestRunParameterSettingsNodeShouldAddNewKeyIfNotPresent() + { + var match = this.runSettingsProvider.GetTestRunParameterNodeMatch("TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//abc\")"); + var runSettingsWithTestRunParameters = "\r\n\r\n \r\n \r\n \r\n"; + + this.runSettingsProvider.UpdateRunSettings("\r\n "); + this.runSettingsProvider.UpdateTestRunParameterSettingsNode(match); + + Assert.AreEqual(runSettingsWithTestRunParameters, this.runSettingsProvider.ActiveRunSettings.SettingsXml); + } + + [TestMethod] + public void UpdateTetsRunParameterSettingsNodeShouldOverrideValueIfKeyIsAlreadyPresent() + { + var runSettingsWithTestRunParameters = "\r\n\r\n \r\n \r\n \r\n"; + var runSettingsWithTestRunParametersOverrode = "\r\n\r\n \r\n \r\n \r\n"; + + this.runSettingsProvider.UpdateRunSettings(runSettingsWithTestRunParameters); + var match = this.runSettingsProvider.GetTestRunParameterNodeMatch("TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//def\")"); + this.runSettingsProvider.UpdateTestRunParameterSettingsNode(match); + + Assert.AreEqual(runSettingsWithTestRunParametersOverrode, this.runSettingsProvider.ActiveRunSettings.SettingsXml); + } + [TestMethod] public void UpdateRunSettingsNodeShouldUpdateKeyIfAlreadyPresent() { @@ -203,7 +229,7 @@ public void QueryRunSettingsNodeShouldReturnCorrectValue() this.runSettingsProvider.UpdateRunSettings(" x86 "); Assert.AreEqual("x86", this.runSettingsProvider.QueryRunSettingsNode("RunConfiguration.TargetPlatform")); } - + private class TestableRunSettingsProvider : IRunSettingsProvider { public RunSettings ActiveRunSettings @@ -211,7 +237,6 @@ public RunSettings ActiveRunSettings get; set; } - public void SetActiveRunSettings(RunSettings runSettings) { this.ActiveRunSettings = runSettings; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs index b7cca3f296..a0fb8316f3 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs @@ -5,7 +5,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.DataCollection { using System.IO; using System.Reflection; - + using Coverlet.Collector.DataCollection; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; @@ -64,7 +64,7 @@ public void InProcDataCollectorShouldNotThrowExceptionIfAssemblyDoesNotContainAn public void InProcDataCollectorShouldInitializeIfAssemblyContainsAnyInProcDataCollector() { var typeInfo = typeof(TestableInProcDataCollector).GetTypeInfo(); - + this.assemblyLoadContext.Setup(alc => alc.LoadAssemblyFromPath(It.IsAny())) .Returns(typeInfo.Assembly); @@ -79,6 +79,27 @@ public void InProcDataCollectorShouldInitializeIfAssemblyContainsAnyInProcDataCo Assert.AreEqual(this.inProcDataCollector.AssemblyQualifiedName, typeInfo.AssemblyQualifiedName); } + [TestMethod] + public void InProcDataCollectorLoadCoverlet() + { + var typeInfo = typeof(CoverletInProcDataCollector).GetTypeInfo(); + + Assert.AreEqual("9.9.9.9", typeInfo.Assembly.GetName().Version.ToString()); + + this.assemblyLoadContext.Setup(alc => alc.LoadAssemblyFromPath(It.IsAny())) + .Returns(typeInfo.Assembly); + + this.inProcDataCollector = new InProcDataCollector( + typeInfo.Assembly.Location, + "Coverlet.Collector.DataCollection.CoverletInProcDataCollector, coverlet.collector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + typeof(InProcDataCollection).GetTypeInfo(), + string.Empty, + this.assemblyLoadContext.Object); + + Assert.IsNotNull(this.inProcDataCollector.AssemblyQualifiedName); + Assert.AreEqual(this.inProcDataCollector.AssemblyQualifiedName, typeInfo.AssemblyQualifiedName); + } + private class TestableInProcDataCollector : InProcDataCollection { public void Initialize(IDataCollectionSink dataCollectionSink) diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj index 12e0cff4dd..d99d8a4486 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj @@ -18,6 +18,7 @@ true + diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs index a86ef7987d..6b8cc39ed8 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs @@ -167,9 +167,10 @@ private void ValidateTestMethodProperties(string testName, string fullyQualified TestPlatformObjectModel.TestResult result = new TestPlatformObjectModel.TestResult(testCase); var unitTestElement = this.converter.ToTestElement(testCase.Id, Guid.Empty, Guid.Empty, testName, TrxLoggerConstants.UnitTestType, testCase) as UnitTestElement; + var expectedTestName = fullyQualifiedName.StartsWith(expectedClassName) ? fullyQualifiedName.Remove(0, $"{expectedClassName}.".Length) : fullyQualifiedName; Assert.AreEqual(expectedClassName, unitTestElement.TestMethod.ClassName); - Assert.AreEqual(testName, unitTestElement.TestMethod.Name); + Assert.AreEqual(expectedTestName, unitTestElement.TestMethod.Name); } private static TestCase CreateTestCase(string fullyQualifiedName) diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 888fbf7cfc..0ebecc7b2b 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -253,7 +253,7 @@ public void GetTestHostProcessStartInfoShouldUseTestHostX86ExePresentOnWindows() } [TestMethod] - public void GetTestHostProcessStartInfoShouldUseDotnetExeOnUnix() + public void GetTestHostProcessStartInfoShouldUseDotnetExeOnUnixWithTestHostDllPath() { this.mockFileHelper.Setup(ph => ph.Exists("testhost.x86.exe")).Returns(true); this.mockFileHelper.Setup(ph => ph.Exists("testhost.dll")).Returns(true); @@ -262,6 +262,7 @@ public void GetTestHostProcessStartInfoShouldUseDotnetExeOnUnix() var startInfo = this.GetDefaultStartInfo(); StringAssert.Contains(startInfo.FileName, "dotnet"); + StringAssert.Contains(startInfo.Arguments, "testhost.dll"); } [TestMethod] @@ -569,15 +570,25 @@ public void GetTestPlatformExtensionsShouldReturnEmptySetIfSourceDirectoryIsEmpt } [TestMethod] - public void GetTestPlatformExtensionsShouldAddDataCollectorsExtensionsIfPresent() + public void GetTestPlatformExtensionsShouldOnlyAddCoverletDataCollectorsExtensionsIfPresent() { this.mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); this.mockFileHelper.Setup(fh => fh.EnumerateFiles(It.IsAny(), SearchOption.TopDirectoryOnly, It.IsAny())).Returns(new[] { "foo.dll" }); - var extensions = this.dotnetHostManager.GetTestPlatformExtensions(this.testSource, new List { "abc.datacollector.dll" }); + var extensions = this.dotnetHostManager.GetTestPlatformExtensions(this.testSource, new List { "coverlet.collector.dll" }); Assert.AreEqual(1, extensions.Count()); } + [TestMethod] + public void GetTestPlatformExtensionsShouldNotAddNonCoverletDataCollectorsExtensionsIfPresent() + { + this.mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); + this.mockFileHelper.Setup(fh => fh.EnumerateFiles(It.IsAny(), SearchOption.TopDirectoryOnly, It.IsAny())).Returns(new[] { "foo.dll" }); + var extensions = this.dotnetHostManager.GetTestPlatformExtensions(this.testSource, new List { "abc.dataollector.dll" }); + + Assert.AreEqual(0, extensions.Count()); + } + [TestMethod] public async Task LaunchTestHostShouldLaunchProcessWithConnectionInfo() { diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 111eebf423..9aa4880d2b 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -106,7 +106,18 @@ public static string PrepareArguments(string testAssembly, string testAdapterPat /// Arguments provided to vstest.console.exe public void InvokeVsTest(string arguments) { - this.Execute(arguments, out this.standardTestOutput, out this.standardTestError, out this.runnerExitCode); + this.ExecuteVsTestConsole(arguments, out this.standardTestOutput, out this.standardTestError, out this.runnerExitCode); + this.FormatStandardOutCome(); + } + + + /// + /// Invokes vstest.console with specified arguments. + /// + /// Arguments provided to vstest.console.exe + public void InvokeDotnetTest(string arguments) + { + this.ExecutePatchedDotnet("test", arguments, out this.standardTestOutput, out this.standardTestError, out this.runnerExitCode); this.FormatStandardOutCome(); } @@ -353,6 +364,17 @@ protected string GetAssetFullPath(string assetName, string targetFramework) return this.testEnvironment.GetTestAsset(assetName, targetFramework); } + protected string GetProjectFullPath(string projectName) + { + return this.testEnvironment.GetTestProject(projectName); + } + + protected string GetProjectAssetFullPath(string projectName, string assetName) + { + var projectPath = this.testEnvironment.GetTestProject(projectName); + return Path.Combine(Path.GetDirectoryName(projectPath), assetName); + } + protected string GetTestAdapterPath(UnitTestFramework testFramework = UnitTestFramework.MSTest) { string adapterRelativePath = string.Empty; @@ -478,7 +500,7 @@ private static string GetTestMethodName(string testFullName) return testMethodName; } - private void Execute(string args, out string stdOut, out string stdError, out int exitCode) + private void ExecuteVsTestConsole(string args, out string stdOut, out string stdError, out int exitCode) { if (this.IsNetCoreRunner()) { @@ -487,46 +509,88 @@ private void Execute(string args, out string stdOut, out string stdError, out in this.arguments = args; - using (Process vstestconsole = new Process()) + this.ExecuteApplication(this.GetConsoleRunnerPath(), args, out stdOut, out stdError, out exitCode); + } + + /// + /// Executes a local copy of dotnet that has VSTest task installed and possibly other modifications. Do not use this to + /// do your builds or to run general tests, unless you want your changes to be reflected. + /// + /// + /// + /// + /// + /// + private void ExecutePatchedDotnet(string command, string args, out string stdOut, out string stdError, out int exitCode) + { + var environmentVariables = new Dictionary { + ["DOTNET_MULTILEVEL_LOOKUP"] = "0" + }; + + var patchedDotnetPath = Path.Combine(this.testEnvironment.TestArtifactsDirectory, @"dotnet\dotnet.exe"); ; + this.ExecuteApplication(patchedDotnetPath, string.Join(" ", command, args), out stdOut, out stdError, out exitCode, environmentVariables); + } + + private void ExecuteApplication(string path, string args, out string stdOut, out string stdError, out int exitCode, Dictionary environmentVariables = null) + { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentException("Executable path must not be null or whitespace.", nameof(path)); + } + + var executableName = Path.GetFileName(path); + + using (Process process = new Process()) { - Console.WriteLine("IntegrationTestBase.Execute: Starting vstest.console.exe"); - vstestconsole.StartInfo.FileName = this.GetConsoleRunnerPath(); - vstestconsole.StartInfo.Arguments = args; - vstestconsole.StartInfo.UseShellExecute = false; + Console.WriteLine($"IntegrationTestBase.Execute: Starting {executableName}"); + process.StartInfo.FileName = path; + process.StartInfo.Arguments = args; + process.StartInfo.UseShellExecute = false; //vstestconsole.StartInfo.WorkingDirectory = testEnvironment.PublishDirectory; - vstestconsole.StartInfo.RedirectStandardError = true; - vstestconsole.StartInfo.RedirectStandardOutput = true; - vstestconsole.StartInfo.CreateNoWindow = true; - vstestconsole.StartInfo.StandardOutputEncoding = Encoding.UTF8; - vstestconsole.StartInfo.StandardErrorEncoding = Encoding.UTF8; + process.StartInfo.RedirectStandardError = true; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.CreateNoWindow = true; + process.StartInfo.StandardOutputEncoding = Encoding.UTF8; + process.StartInfo.StandardErrorEncoding = Encoding.UTF8; + if (environmentVariables != null) { + foreach (var variable in environmentVariables) { + if (process.StartInfo.EnvironmentVariables.ContainsKey(variable.Key)) { + process.StartInfo.EnvironmentVariables[variable.Key] = variable.Value; + } + else + { + process.StartInfo.EnvironmentVariables.Add(variable.Key, variable.Value); + } + } + } var stdoutBuffer = new StringBuilder(); var stderrBuffer = new StringBuilder(); - vstestconsole.OutputDataReceived += (sender, eventArgs) => + process.OutputDataReceived += (sender, eventArgs) => { stdoutBuffer.Append(eventArgs.Data).Append(Environment.NewLine); }; - vstestconsole.ErrorDataReceived += (sender, eventArgs) => stderrBuffer.Append(eventArgs.Data).Append(Environment.NewLine); + process.ErrorDataReceived += (sender, eventArgs) => stderrBuffer.Append(eventArgs.Data).Append(Environment.NewLine); - Console.WriteLine("IntegrationTestBase.Execute: Path = {0}", vstestconsole.StartInfo.FileName); - Console.WriteLine("IntegrationTestBase.Execute: Arguments = {0}", vstestconsole.StartInfo.Arguments); + Console.WriteLine("IntegrationTestBase.Execute: Path = {0}", process.StartInfo.FileName); + Console.WriteLine("IntegrationTestBase.Execute: Arguments = {0}", process.StartInfo.Arguments); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); - vstestconsole.Start(); - vstestconsole.BeginOutputReadLine(); - vstestconsole.BeginErrorReadLine(); - if (!vstestconsole.WaitForExit(80 * 1000)) + process.Start(); + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + if (!process.WaitForExit(80 * 1000)) { - Console.WriteLine("IntegrationTestBase.Execute: Timed out waiting for vstest.console.exe. Terminating the process."); - vstestconsole.Kill(); + Console.WriteLine($"IntegrationTestBase.Execute: Timed out waiting for {executableName}. Terminating the process."); + process.Kill(); } else { // Ensure async buffers are flushed - vstestconsole.WaitForExit(); + process.WaitForExit(); } stopwatch.Stop(); @@ -535,11 +599,11 @@ private void Execute(string args, out string stdOut, out string stdError, out in stdError = stderrBuffer.ToString(); stdOut = stdoutBuffer.ToString(); - exitCode = vstestconsole.ExitCode; + exitCode = process.ExitCode; Console.WriteLine("IntegrationTestBase.Execute: stdError = {0}", stdError); Console.WriteLine("IntegrationTestBase.Execute: stdOut = {0}", stdOut); - Console.WriteLine("IntegrationTestBase.Execute: Stopped vstest.console.exe. Exit code = {0}", exitCode); + Console.WriteLine($"IntegrationTestBase.Execute: Stopped {executableName}. Exit code = {0}", exitCode); } } diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs index 2d4810cf72..af9389c9e5 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs @@ -57,6 +57,7 @@ public IntegrationTestEnvironment() // Need to remove this assumption when we move to a CDP. this.PackageDirectory = Path.Combine(TestPlatformRootDirectory, @"packages"); this.ToolsDirectory = Path.Combine(TestPlatformRootDirectory, @"tools"); + this.TestArtifactsDirectory = Path.Combine(TestPlatformRootDirectory, "artifacts", "testArtifacts"); this.RunnerFramework = "net451"; } @@ -193,6 +194,15 @@ public string ToolsDirectory private set; } + /// + /// Gets the test artifacts directory. + /// + public string TestArtifactsDirectory + { + get; + private set; + } + /// /// Gets the application type. /// Supported values = net451, netcoreapp1.0. @@ -293,5 +303,30 @@ private static Dictionary GetDependencies(string testPlatformRoo return dependencyProps; } + + /// + /// Gets the full path to a test asset. + /// + /// Name of the asset with extension. E.g. SimpleUnitTest.csproj + /// Full path to the test asset. + /// + /// Test assets follow several conventions: + /// (a) They are built for supported frameworks. See . + /// (b) They are built for provided build configuration. + /// (c) Name of the test asset matches the parent directory name. E.g. TestAssets\SimpleUnitTest\SimpleUnitTest.csproj must + /// produce TestAssets\SimpleUnitTest\SimpleUnitTest.csproj + /// + public string GetTestProject(string assetName) + { + var simpleAssetName = Path.GetFileNameWithoutExtension(assetName); + var assetPath = Path.Combine( + this.TestAssetsPath, + simpleAssetName, + assetName); + + Assert.IsTrue(File.Exists(assetPath), "GetTestAsset: Path not found: {0}.", assetPath); + + return assetPath; + } } } \ No newline at end of file diff --git a/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj b/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj new file mode 100644 index 0000000000..35adc06cfd --- /dev/null +++ b/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj @@ -0,0 +1,31 @@ + + + + + + + + + netcoreapp2.1;net451 + x64 + fail.runsettings + + + + $(MSTestFrameworkVersion) + + + $(MSTestAdapterVersion) + + + $(NETTestSdkPreviousVersion) + + + + + + + + + + \ No newline at end of file diff --git a/test/TestAssets/ProjectFileRunSettingsTestProject/UnitTest1.cs b/test/TestAssets/ProjectFileRunSettingsTestProject/UnitTest1.cs new file mode 100644 index 0000000000..8e05942a5d --- /dev/null +++ b/test/TestAssets/ProjectFileRunSettingsTestProject/UnitTest1.cs @@ -0,0 +1,20 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ProjectFileRunSettingsTestProject +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + // this project specifies runsettings in it's proj file + // that runsettings say that inconclusive should translate to + // failed. + // we can then easily figure out if the settings were applied + // correctly if we set the test as failed, or did not apply if the + // test is shown as skipped + Assert.Inconclusive(); + } + } +} diff --git a/test/TestAssets/ProjectFileRunSettingsTestProject/fail.runsettings b/test/TestAssets/ProjectFileRunSettingsTestProject/fail.runsettings new file mode 100644 index 0000000000..74797d6e14 --- /dev/null +++ b/test/TestAssets/ProjectFileRunSettingsTestProject/fail.runsettings @@ -0,0 +1,6 @@ + + + + True + + diff --git a/test/TestAssets/ProjectFileRunSettingsTestProject/inconclusive.runsettings b/test/TestAssets/ProjectFileRunSettingsTestProject/inconclusive.runsettings new file mode 100644 index 0000000000..e838b14748 --- /dev/null +++ b/test/TestAssets/ProjectFileRunSettingsTestProject/inconclusive.runsettings @@ -0,0 +1,6 @@ + + + + False + + diff --git a/test/TestAssets/TestAssets.sln/TestAssets.sln b/test/TestAssets/TestAssets.sln/TestAssets.sln index 2b827bef68..cf291b0444 100644 --- a/test/TestAssets/TestAssets.sln/TestAssets.sln +++ b/test/TestAssets/TestAssets.sln/TestAssets.sln @@ -47,7 +47,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewtonSoftDependency", "..\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppDomainGetAssembliesTestProject", "..\AppDomainGetAssembliesTestProject\AppDomainGetAssembliesTestProject.csproj", "{BF090BCE-CC7D-4359-93E2-30F2B454F751}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvironmentVariablesTestProject", "..\EnvironmentVariablesTestProject\EnvironmentVariablesTestProject.csproj", "{BA53C202-55D6-4BBC-A24A-444B2D5F6309}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnvironmentVariablesTestProject", "..\EnvironmentVariablesTestProject\EnvironmentVariablesTestProject.csproj", "{BA53C202-55D6-4BBC-A24A-444B2D5F6309}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectFileRunSettingsTestProject", "..\ProjectFileRunSettingsTestProject\ProjectFileRunSettingsTestProject.csproj", "{A0113409-56D3-4060-BD94-A4BA4739712D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -147,6 +149,10 @@ Global {BA53C202-55D6-4BBC-A24A-444B2D5F6309}.Debug|Any CPU.Build.0 = Debug|Any CPU {BA53C202-55D6-4BBC-A24A-444B2D5F6309}.Release|Any CPU.ActiveCfg = Release|Any CPU {BA53C202-55D6-4BBC-A24A-444B2D5F6309}.Release|Any CPU.Build.0 = Release|Any CPU + {A0113409-56D3-4060-BD94-A4BA4739712D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0113409-56D3-4060-BD94-A4BA4739712D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0113409-56D3-4060-BD94-A4BA4739712D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0113409-56D3-4060-BD94-A4BA4739712D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/TestAssets/coverlet.collector/CoverletInProcDataCollector.cs b/test/TestAssets/coverlet.collector/CoverletInProcDataCollector.cs new file mode 100644 index 0000000000..844e681ce6 --- /dev/null +++ b/test/TestAssets/coverlet.collector/CoverletInProcDataCollector.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System; + +using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector.InProcDataCollector; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.InProcDataCollector; + +[assembly: AssemblyKeyFile("key.snk")] +[assembly: AssemblyVersion("9.9.9.9")] + +namespace Coverlet.Collector.DataCollection +{ + // This class MUST have the same full name as + // https://github.com/tonerdo/coverlet/blob/master/src/coverlet.collector/InProcDataCollection/CoverletInProcDataCollector.cs + // to mimic real behaviour + public class CoverletInProcDataCollector : InProcDataCollection + { + public void Initialize(IDataCollectionSink dataCollectionSink) + { + throw new NotImplementedException(); + } + + public void TestCaseEnd(TestCaseEndArgs testCaseEndArgs) + { + throw new NotImplementedException(); + } + + public void TestCaseStart(TestCaseStartArgs testCaseStartArgs) + { + throw new NotImplementedException(); + } + + public void TestSessionEnd(TestSessionEndArgs testSessionEndArgs) + { + throw new NotImplementedException(); + } + + public void TestSessionStart(TestSessionStartArgs testSessionStartArgs) + { + throw new NotImplementedException(); + } + } +} diff --git a/test/TestAssets/coverlet.collector/coverlet.collector.csproj b/test/TestAssets/coverlet.collector/coverlet.collector.csproj new file mode 100644 index 0000000000..74bce9aef6 --- /dev/null +++ b/test/TestAssets/coverlet.collector/coverlet.collector.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp2.1;net451 + false + + + + + + + diff --git a/test/TestAssets/coverlet.collector/key.snk b/test/TestAssets/coverlet.collector/key.snk new file mode 100644 index 0000000000000000000000000000000000000000..16bbaafe56640fff2bb1ea859376bf05fc4e16a4 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096UU80jBuSjUS4)T49si3te?0xBsX&;tH zbNnilKVXtEhuE5L&ca$?U-g4p(}tR`on)~h&?CLFOwu@-$kp3^+N1#-9kGM!V6F~t zvLp)j=FxT60kiI-XMasJ;fF~xwRNVE(p$&}7NK-@PQ@(5BHP@^fauE>f=7esFKD+{ z-ouXH3lZm*4WS#fa^QPKkBQ7I7pz|^T;#%KVPr8d@T+u)=c{? z_bYGk#-K9s=cLW6Pf*4s>OMRAw`&PUFKU$X>{YfoBmDrH^TlEB^c>0(TzO}6iA;5p z!no^e44n7XhV?Fs=4Fc7k}Rns~y1aBE} zoafdvGIV*A_pec`eh^l2T!BAdjTP@!_EKA__9jck$w^BJHMw_C?JYa3n9 ziq2wytQ&fH4>ToBL*KcWp5#3+qn~BZ4uT`&OY24k`+iuhF(-tE{&X7-M{6^ZSUYNO2ucDB`;(lnSYs6VbCS;ZO|&EkWW)A^ ir_C8q96uAQu)_{UzZPv|Z)gd$t8}=7=A2ztk1IMFh8@cQ literal 0 HcmV?d00001 diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 45f2a624b3..577abe002a 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -1131,6 +1131,51 @@ public void AttachmentInformationShouldBeWrittenToConsoleIfAttachmentsArePresent this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.AttachmentOutputFormat, uriDataAttachment1.Uri.LocalPath), OutputLevel.Information), Times.Once()); } + [TestMethod] + public void ResultsInHeirarchichalOrderShouldReportCorrectCount() + { + var loggerEvents = new InternalTestLoggerEvents(TestSessionMessageLogger.Instance); + loggerEvents.EnableEvents(); + var parameters = new Dictionary(); + parameters.Add("verbosity", "normal"); + this.consoleLogger.Initialize(loggerEvents, parameters); + + TestCase testCase1 = CreateTestCase("TestCase1"); + TestCase testCase2 = CreateTestCase("TestCase2"); + TestCase testCase3 = CreateTestCase("TestCase3"); + + Guid parentExecutionId = Guid.NewGuid(); + TestProperty ParentExecIdProperty = TestProperty.Register("ParentExecId", "ParentExecId", typeof(Guid), TestPropertyAttributes.Hidden, typeof(ObjectModel.TestResult)); + TestProperty ExecutionIdProperty = TestProperty.Register("ExecutionId", "ExecutionId", typeof(Guid), TestPropertyAttributes.Hidden, typeof(ObjectModel.TestResult)); + TestProperty TestTypeProperty = TestProperty.Register("TestType", "TestType" , typeof(Guid), TestPropertyAttributes.Hidden, typeof(ObjectModel.TestResult)); + + var result1 = new ObjectModel.TestResult(testCase1) { Outcome = TestOutcome.Failed }; + result1.SetPropertyValue(ExecutionIdProperty, parentExecutionId); + + var result2 = new ObjectModel.TestResult(testCase2) { Outcome = TestOutcome.Passed}; + result2.SetPropertyValue(ExecutionIdProperty, Guid.NewGuid()); + result2.SetPropertyValue(ParentExecIdProperty, parentExecutionId); + + var result3 = new ObjectModel.TestResult(testCase3) { Outcome = TestOutcome.Failed }; + result3.SetPropertyValue(ExecutionIdProperty, Guid.NewGuid()); + result3.SetPropertyValue(ParentExecIdProperty, parentExecutionId); + + loggerEvents.RaiseTestResult(new TestResultEventArgs(result1)); + loggerEvents.RaiseTestResult(new TestResultEventArgs(result2)); + loggerEvents.RaiseTestResult(new TestResultEventArgs(result3)); + + loggerEvents.CompleteTestRun(null, false, false, null, null, new TimeSpan(1, 0, 0, 0)); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, 1), OutputLevel.Information), Times.Once()); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, 1), OutputLevel.Information), Times.Once()); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryTotalTests, 2), OutputLevel.Information), Times.Once()); + } + + private TestCase CreateTestCase(string testCaseName) + { + return new TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName"); + } + private void Setup() { this.mockRequestData = new Mock(); diff --git a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs index 51aa3107db..2a8d4ea7bb 100644 --- a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs @@ -14,6 +14,7 @@ namespace vstest.console.UnitTests.Processors using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestTools.UnitTesting; + using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; [TestClass] public class CLIRunSettingsArgumentProcessorTests @@ -122,6 +123,19 @@ public void InitializeShouldIgnoreKeyIfValueIsNotPassed() Assert.AreEqual(RunSettingsWithDeploymentDisabled, settingsProvider.ActiveRunSettings.SettingsXml); } + [DataRow("Testameter.Parameter(name=\"asf\",value=\"rgq\")")] + [DataRow("TestRunParameter.Parameter(name=\"asf\",value=\"rgq\")")] + [TestMethod] + public void InitializeShouldThrowErrorIfArgumentIsInValid(string arg) + { + var args = new string[] { arg }; + var str = string.Format(CommandLineResources.MalformedRunSettingsKey); + + CommandLineException ex = Assert.ThrowsException(() => this.executor.Initialize(args)); + + Assert.AreEqual(str, ex.Message); + } + [TestMethod] public void InitializeShouldIgnoreWhiteSpaceInBeginningOrEndOfKey() { @@ -258,6 +272,82 @@ public void InitializeShouldNotUpdateCommandLineOptionsArchitectureAndFxIfNotPro Assert.IsFalse(this.commandLineOptions.FrameworkVersionSpecified); } + [DynamicData(nameof(TestRunParameterArgValidTestCases), DynamicDataSourceType.Method)] + [DataTestMethod] + public void InitializeShouldValidateTestRunParameter(string arg, string runSettingsWithTestRunParameters) + { + var args = new string[] { arg }; + + this.executor.Initialize(args); + + Assert.IsNotNull(this.settingsProvider.ActiveRunSettings); + Assert.AreEqual(runSettingsWithTestRunParameters, settingsProvider.ActiveRunSettings.SettingsXml); + } + + [DynamicData(nameof(TestRunParameterArgInvalidTestCases), DynamicDataSourceType.Method)] + [DataTestMethod] + public void InitializeShouldThrowErrorIfTestRunParameterNodeIsInValid(string arg) + { + var args = new string[] { arg }; + var str = string.Format(CommandLineResources.InvalidTestRunParameterArgument, arg); + + CommandLineException ex = Assert.ThrowsException(() => this.executor.Initialize(args)); + + Assert.AreEqual(str, ex.Message); + } + + public static IEnumerable TestRunParameterArgInvalidTestCases() + { + return invalidTestCases; + } + + private static readonly List invalidTestCases = new List + { + new object[] { "TestRunParameters.Parameter(name=asf,value=rgq)" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq\" )"}, + new object[] { "TestRunParameters.Parameter( name=\"asf\",value=\"rgq\")" }, + new object[] { "TestRunParametersParameter(name=\"asf\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Paramete(name=\"asf\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parametername=\"asf\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(ame=\"asf\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name\"asf\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\" value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",alue=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq\"" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq\")wfds" }, + new object[] { "TestRunParameters.Parameter(name=\"\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"\")" }, + new object[] { "TestRunParameters.Parameter(name=asf\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf,value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value=rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq)" }, + new object[] { "TestRunParameters.Parameter(name=\"asf@#!\",value=\"rgq\")" }, + new object[] { "TestRunParameters.Parameter(name=\"\",value=\"fgf\")" }, + new object[] { "TestRunParameters.Parameter(name=\"gag\",value=\"\")" }, + new object[] { "TestRunParameters.Parameter(name=\"gag\")" } + }; + + public static IEnumerable TestRunParameterArgValidTestCases() + { + return validTestCases; + } + + private static readonly List validTestCases = new List + { + new object[] { "TestRunParameters.Parameter(name=\"weburl\",value=\"&><\")" , + "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + }, + new object[] { "TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//abc\")" , + "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + }, + new object[] { "TestRunParameters.Parameter(name= \"a_sf123_12\",value= \"2324346a!@#$%^*()_+-=':;.,/?{}[]|\")" , + "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + }, + new object[] { "TestRunParameters.Parameter(name = \"weburl\" , value = \"http://localhost//abc\")" , + "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + }, + }; #endregion } } From d22a535dda89a84ab3bf5de18fbe5078243422e5 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Thu, 9 Jan 2020 13:40:54 +0100 Subject: [PATCH 19/28] Fix acceptance tests --- scripts/build.ps1 | 12 ++++---- src/vstest.console/Internal/ConsoleLogger.cs | 32 +++++++++----------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index a3b79daaa3..74ffab9e6f 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -909,16 +909,16 @@ Write-Log "Test platform environment variables: " Get-ChildItem env: | Where-Object -FilterScript { $_.Name.StartsWith("TP_") } | Format-Table Write-Log "Test platform build variables: " Get-Variable | Where-Object -FilterScript { $_.Name.StartsWith("TPB_") } | Format-Table -Install-DotNetCli +# Install-DotNetCli Restore-Package Update-LocalizedResources Invoke-Build Publish-Package -Publish-PatchedDotnet -Publish-Tests -Create-VsixPackage -Create-NugetPackages -Generate-Manifest +# Publish-PatchedDotnet +# Publish-Tests +# Create-VsixPackage +# Create-NugetPackages +# Generate-Manifest Write-Log "Build complete. {$(Get-ElapsedTime($timer))}" if ($Script:ScriptFailed) { Exit 1 } else { Exit 0 } \ No newline at end of file diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index e712c013b8..bb120daf5c 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -118,7 +118,6 @@ internal enum Verbosity #endif private bool testRunHasErrorMessages = false; - private ConcurrentDictionary leafExecutionIdAndTestOutcomePairDictionary = new ConcurrentDictionary(); /// /// Framework on which the test runs. @@ -171,7 +170,7 @@ protected static IOutput Output /// Tracks leaf test outcomes per source. This is needed to correctly count hierarchical tests as well as /// tracking counts per source for the minimal and quiet output. /// - private ConcurrentDictionary> leafTestOutcomesPerSource { get; set; } + private ConcurrentDictionary leafTestResults { get; set; } #endregion @@ -208,7 +207,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) // Register for the discovery events. events.DiscoveryMessage += this.TestMessageHandler; - this.leafTestOutcomesPerSource = new ConcurrentDictionary>(); + this.leafTestResults = new ConcurrentDictionary(); // TODO Get changes from https://github.com/Microsoft/vstest/pull/1111/ // events.DiscoveredTests += DiscoveredTestsHandler; @@ -522,13 +521,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - ConcurrentDictionary leafTestOutcomes; - if (!this.leafTestOutcomesPerSource.TryGetValue(e.Result.TestCase.Source, out leafTestOutcomes)) - { - leafTestOutcomes = new ConcurrentDictionary(); - this.leafTestOutcomesPerSource.TryAdd(e.Result.TestCase.Source, leafTestOutcomes); - } - + var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) @@ -545,12 +538,12 @@ private void TestResultHandler(object sender, TestResultEventArgs e) var executionId = GetExecutionId(e.Result); var parentExecutionId = GetParentExecutionId(e.Result); - if (parentExecutionId != Guid.Empty && leafTestOutcomes.ContainsKey(parentExecutionId)) + if (parentExecutionId != Guid.Empty && leafTestResults.ContainsKey(parentExecutionId)) { - leafTestOutcomes.TryRemove(parentExecutionId, out _); + leafTestResults.TryRemove(parentExecutionId, out _); } - leafTestOutcomes.TryAdd(executionId, e.Result); + leafTestResults.TryAdd(executionId, e.Result); switch (e.Result.Outcome) { @@ -705,24 +698,27 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) } } - foreach (var sd in this.leafTestOutcomesPerSource) + var leafTestResultsPerSource = this.leafTestResults.Select(p => p.Value).GroupBy(r => r.TestCase.Source); + foreach (var sd in leafTestResultsPerSource) { - var source = sd.Value; + var source = sd.Key; var sourceSummary = new SourceSummary(); - foreach (var result in source.Values) + foreach (var result in sd.ToArray()) { - sourceSummary.Duration += result.Duration; - sourceSummary.TotalTests++; + sourceSummary.Duration += result.Duration; switch (result.Outcome) { case TestOutcome.Passed: + sourceSummary.TotalTests++; sourceSummary.PassedTests++; break; case TestOutcome.Failed: + sourceSummary.TotalTests++; sourceSummary.FailedTests++; break; case TestOutcome.Skipped: + sourceSummary.TotalTests++; sourceSummary.SkippedTests++; break; default: From 9ba8b23d2d24f93dbdf459da5e846d436adf7d96 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Thu, 9 Jan 2020 16:16:00 +0100 Subject: [PATCH 20/28] Revert build changes --- scripts/build.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 74ffab9e6f..a3b79daaa3 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -909,16 +909,16 @@ Write-Log "Test platform environment variables: " Get-ChildItem env: | Where-Object -FilterScript { $_.Name.StartsWith("TP_") } | Format-Table Write-Log "Test platform build variables: " Get-Variable | Where-Object -FilterScript { $_.Name.StartsWith("TPB_") } | Format-Table -# Install-DotNetCli +Install-DotNetCli Restore-Package Update-LocalizedResources Invoke-Build Publish-Package -# Publish-PatchedDotnet -# Publish-Tests -# Create-VsixPackage -# Create-NugetPackages -# Generate-Manifest +Publish-PatchedDotnet +Publish-Tests +Create-VsixPackage +Create-NugetPackages +Generate-Manifest Write-Log "Build complete. {$(Get-ElapsedTime($timer))}" if ($Script:ScriptFailed) { Exit 1 } else { Exit 0 } \ No newline at end of file From 61859a5e2c61c0d5bde39da2ce9eb9432aa07395 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Thu, 28 May 2020 17:49:26 +0200 Subject: [PATCH 21/28] Fix test --- src/vstest.console/Internal/ConsoleLogger.cs | 33 ++++++++++++------- .../Internal/ConsoleLoggerTests.cs | 2 +- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 824a70d081..a66c16873e 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -538,12 +538,21 @@ private void TestResultHandler(object sender, TestResultEventArgs e) var executionId = GetExecutionId(e.Result); var parentExecutionId = GetParentExecutionId(e.Result); - if (parentExecutionId != Guid.Empty && leafTestResults.ContainsKey(parentExecutionId)) + if (parentExecutionId != Guid.Empty) { + // Not checking the result value. + // This would return false if the id did not exist, + // or true if it did exist. In either case the id is not in the dictionary + // which is our goal. leafTestResults.TryRemove(parentExecutionId, out _); } - leafTestResults.TryAdd(executionId, e.Result); + if (!leafTestResults.TryAdd(executionId, e.Result)) + { + // This would happen if the key already exists. This should not happen, because we are + // inserting by GUID key, so this would mean an error in our code. + throw new InvalidOperationException($"ExecutionId {executionId} already exists."); + }; switch (e.Result.Outcome) { @@ -675,6 +684,8 @@ private string GetFormattedDurationString(TimeSpan duration) /// private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { + var d = DateTime.Now; + Output.WriteLine($"called at { d:hh:mm:ss.fff tt}", OutputLevel.Information); // Stop the progress indicator as we are about to print the summary this.progressIndicator?.Stop(); var passedTests = 0; @@ -706,7 +717,7 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) foreach (var result in sd.ToArray()) { - sourceSummary.Duration += result.Duration; + sourceSummary.Duration += result.Duration; switch (result.Outcome) { case TestOutcome.Passed: @@ -724,15 +735,15 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) default: break; } + } - if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) - { - var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); - var resultString = sourceSummary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; - var color = sourceSummary.FailedTests > 0 ? ConsoleColor.Red : sourceSummary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; - var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString, sourceSummary.TotalTests, sourceSummary.PassedTests, sourceSummary.FailedTests, sourceSummary.SkippedTests, GetFormattedDurationString(sourceSummary.Duration), sd.Key.Split('\\').Last(), frameworkString); - Output.Information(false, color, outputLine); - } + if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) + { + var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); + var resultString = sourceSummary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; + var color = sourceSummary.FailedTests > 0 ? ConsoleColor.Red : sourceSummary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; + var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString, sourceSummary.TotalTests, sourceSummary.PassedTests, sourceSummary.FailedTests, sourceSummary.SkippedTests, GetFormattedDurationString(sourceSummary.Duration), sd.Key.Split('\\').Last(), frameworkString); + Output.Information(false, color, outputLine); } passedTests += sourceSummary.PassedTests; diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 577abe002a..6fb8315d82 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -612,7 +612,7 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Passed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", expectedFramework), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Failed, 5, 1, 1, 1, "1 h 6 m", "TestSource", expectedFramework), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Failed, 3, 1, 1, 1, "1 h 6 m", "TestSource", expectedFramework), OutputLevel.Information), Times.Once); } [TestMethod] From 75d50f24c236a8a3d5096bcd6ed032b34b04610b Mon Sep 17 00:00:00 2001 From: nohwnd Date: Thu, 28 May 2020 18:49:11 +0200 Subject: [PATCH 22/28] Format output to align --- src/vstest.console/Internal/ConsoleLogger.cs | 103 ++++++++++++++++-- .../Resources/Resources.Designer.cs | 32 +++++- src/vstest.console/Resources/Resources.resx | 11 +- .../Internal/ConsoleLoggerTests.cs | 25 ++++- 4 files changed, 156 insertions(+), 15 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index a66c16873e..8da1b26cb4 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal using System.Globalization; using System.Linq; using System.Text; - + using System.Xml.XPath; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -95,6 +95,16 @@ internal class ConsoleLogger : ITestLoggerWithParameters /// public const string ExecutionIdPropertyIdentifier = "ExecutionId"; + // Figure out the longest result string (+1 for ! where applicable), so we don't + // get misaligned output on non-english systems + private static int LongestResultIndicator = new[] + { + CommandLineResources.Failed.Length + 1, + CommandLineResources.Passed.Length + 1, + CommandLineResources.Skipped.Length + 1, + CommandLineResources.None.Length + }.Max(); + #endregion internal enum Verbosity @@ -521,7 +531,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - + var testDisplayName = e.Result.DisplayName; if (string.IsNullOrWhiteSpace(e.Result.DisplayName)) @@ -684,8 +694,6 @@ private string GetFormattedDurationString(TimeSpan duration) /// private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { - var d = DateTime.Now; - Output.WriteLine($"called at { d:hh:mm:ss.fff tt}", OutputLevel.Information); // Stop the progress indicator as we are about to print the summary this.progressIndicator?.Stop(); var passedTests = 0; @@ -739,11 +747,88 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) { - var frameworkString = string.IsNullOrEmpty(targetFramework) ? string.Empty : string.Concat('(', targetFramework, ')'); - var resultString = sourceSummary.FailedTests > 0 ? CommandLineResources.Failed : CommandLineResources.Passed; - var color = sourceSummary.FailedTests > 0 ? ConsoleColor.Red : sourceSummary.SkippedTests > 0 ? ConsoleColor.Yellow : ConsoleColor.Green; - var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, resultString, sourceSummary.TotalTests, sourceSummary.PassedTests, sourceSummary.FailedTests, sourceSummary.SkippedTests, GetFormattedDurationString(sourceSummary.Duration), sd.Key.Split('\\').Last(), frameworkString); - Output.Information(false, color, outputLine); + TestOutcome sourceOutcome = TestOutcome.None; + if (sourceSummary.FailedTests > 0) + { + sourceOutcome = TestOutcome.Failed; + } + else if (sourceSummary.PassedTests > 0) + { + sourceOutcome = TestOutcome.Passed; + } + else if (sourceSummary.SkippedTests > 0) + { + sourceOutcome = TestOutcome.Skipped; + } + + + string resultString; + switch (sourceOutcome) + { + case TestOutcome.Failed: + resultString = (CommandLineResources.Failed + "!").PadRight(LongestResultIndicator); + break; + case TestOutcome.Passed: + resultString = (CommandLineResources.Passed + "!").PadRight(LongestResultIndicator); + break; + case TestOutcome.Skipped: + resultString = (CommandLineResources.Skipped + "!").PadRight(LongestResultIndicator); + break; + default: + resultString = CommandLineResources.None.PadRight(LongestResultIndicator); + break; + }; + + var failed = sourceSummary.FailedTests.ToString().PadLeft(5); + var passed = sourceSummary.PassedTests.ToString().PadLeft(5); + var skipped = sourceSummary.SkippedTests.ToString().PadLeft(5); + var total = sourceSummary.TotalTests.ToString().PadLeft(5); + + + var frameworkString = string.IsNullOrEmpty(targetFramework) + ? string.Empty + : $"({targetFramework})"; + + var duration = GetFormattedDurationString(sourceSummary.Duration); + var sourceName = sd.Key.Split('\\').Last(); + + var outputLine = string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, + resultString, + failed, + passed, + skipped, + total, + duration, + sourceName, + frameworkString); + + + ConsoleColor? color = null; + if (sourceOutcome == TestOutcome.Failed) + { + color = ConsoleColor.Red; + } + else if (sourceOutcome == TestOutcome.Passed) + { + color = ConsoleColor.Green; + } + else if (sourceOutcome == TestOutcome.Skipped) + { + color = ConsoleColor.Yellow; + } + + if (color != null) + { + Output.Information(false, color.Value, outputLine); + } + else + { + Output.Information(false, outputLine); + } + + Output.Information(false, CommandLineResources.TestRunSummaryAssemblyAndFramework, + sourceName, + frameworkString); } passedTests += sourceSummary.PassedTests; diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 28fc8216f3..06e0508ca7 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -11,8 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Resources { using System; - using System.Reflection; - + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -1029,6 +1028,15 @@ internal static string NonDefaultFrameworkAndOrArchDetected { } } + /// + /// Looks up a localized string similar to None. + /// + internal static string None { + get { + return ResourceManager.GetString("None", resourceCulture); + } + } + /// /// Looks up a localized string similar to App package '{0}' does not has test executor entry point. For running unit tests for Windows Store apps, create app package using Windows Store app Unit Test Library project.. /// @@ -1329,6 +1337,15 @@ internal static string SettingFormat { } } + /// + /// Looks up a localized string similar to Skipped. + /// + internal static string Skipped { + get { + return ResourceManager.GetString("Skipped", resourceCulture); + } + } + /// /// Looks up a localized string similar to Skipped {0}. /// @@ -1578,7 +1595,7 @@ internal static string TestRunSuccessful { } /// - /// Looks up a localized string similar to {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}.. + /// Looks up a localized string similar to {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5}. /// internal static string TestRunSummary { get { @@ -1586,6 +1603,15 @@ internal static string TestRunSummary { } } + /// + /// Looks up a localized string similar to - {0} {1}. + /// + internal static string TestRunSummaryAssemblyAndFramework { + get { + return ResourceManager.GetString("TestRunSummaryAssemblyAndFramework", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed: {0}. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 7f920234dd..b36f0842c2 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -735,7 +735,7 @@ A total of {0} test files matched the specified pattern. - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} Failed @@ -747,4 +747,13 @@ The test run parameter argument '{0}' is invalid. Please use the format below. Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + + + Skipped + + + - {0} {1} + \ No newline at end of file diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 6fb8315d82..51ee7a807f 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -611,8 +611,29 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Passed, 2, 1, 0, 1, "1 m 2 s", "TestSourcePassed", expectedFramework), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, CommandLineResources.Failed, 3, 1, 1, 1, "1 h 6 m", "TestSource", expectedFramework), OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, + (CommandLineResources.Passed + "!").PadRight(8), + 0.ToString().PadLeft(5), + 1.ToString().PadLeft(5), + 1.ToString().PadLeft(5), 2 + .ToString().PadLeft(5), + "1 m 2 s"), OutputLevel.Information), Times.Once); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryAssemblyAndFramework, + "TestSourcePassed", + expectedFramework), OutputLevel.Information), Times.Once); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, + (CommandLineResources.Failed + "!").PadRight(8), + 1.ToString().PadLeft(5), + 1.ToString().PadLeft(5), + 1.ToString().PadLeft(5), + 3.ToString().PadLeft(5), + "1 h 6 m"), OutputLevel.Information), Times.Once); + + this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryAssemblyAndFramework, + "TestSource", + expectedFramework), OutputLevel.Information), Times.Once); } [TestMethod] From d36c66fc91f379a56470e31a74c33ea3e002e967 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Thu, 28 May 2020 19:24:03 +0200 Subject: [PATCH 23/28] Fixing the output, not working adds new line --- src/vstest.console/Internal/ConsoleLogger.cs | 6 +++--- .../Resources/xlf/Resources.cs.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.de.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.es.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.fr.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.it.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.ja.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.ko.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.pl.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.pt-BR.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.ru.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.tr.xlf | 17 ++++++++++++++++- src/vstest.console/Resources/xlf/Resources.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.zh-Hans.xlf | 17 ++++++++++++++++- .../Resources/xlf/Resources.zh-Hant.xlf | 17 ++++++++++++++++- 15 files changed, 227 insertions(+), 17 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 8da1b26cb4..c4f3288dbc 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -867,15 +867,15 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (passedTests > 0) { - Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests)); + Output.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests), OutputLevel.Information, ConsoleColor.Green); } if (failedTests > 0) { - Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests)); + Output.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests), OutputLevel.Information, ConsoleColor.Red); } if (skippedTests > 0) { - Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests)); + Output.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests), OutputLevel.Information, ConsoleColor.Yellow); } } diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index e272450c61..0a744efdd7 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Formát: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index d04942e65a..7cc008972c 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 33ec39d44a..bfddb21c82 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1660,7 +1660,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1681,6 +1681,21 @@ Formato: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 96c22bf93a..0c54337252 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Format : TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index f8039b6822..09e694c69d 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Formato: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index f4659c8c4d..50e3e5b756 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ 形式: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 7af45f1ed6..9b6cd944a3 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ 형식: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 286cf47008..cf8e282eaa 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Format: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 6288c8e5de..e7b4038278 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1657,7 +1657,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a Formato: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 69c9349dce..e3ce37e5a0 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Формат: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index c1ab224a09..d1b34e2b5c 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1657,7 +1657,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin Biçim: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 892be943d3..9522347da8 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -848,7 +848,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -869,6 +869,21 @@ Format : TestRunParameters.Parameter(name="<name>", value="<value>") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index e2f78c3275..537f8dbe97 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1657,7 +1657,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1678,6 +1678,21 @@ 格式: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index c49dfac3bb..0e6a3cf95f 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1658,7 +1658,7 @@ - {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. + {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} {0}! Total: {1}. Pass: {2}. Fail: {3}. Skip: {4}. ({5}) {6} {7}. @@ -1679,6 +1679,21 @@ 格式: TestRunParameters.Parameter(name=\"<name>\", value=\"<value>\") + + None + None + + + + Skipped + Skipped + + + + - {0} {1} + - {0} {1} + + \ No newline at end of file From 86441072c51db70584ab2dd9091e1d01072f9365 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Mon, 13 Jul 2020 14:16:06 +0200 Subject: [PATCH 24/28] check --- src/vstest.console/Internal/ConsoleLogger.cs | 4 ++-- src/vstest.console/Resources/Resources.Designer.cs | 2 +- src/vstest.console/Resources/Resources.resx | 2 +- src/vstest.console/Resources/xlf/Resources.cs.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.de.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.es.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.fr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.it.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ja.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ko.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pl.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pt-BR.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ru.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.tr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 0fd68a3db6..295570394a 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -804,11 +804,11 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (color != null) { - Output.Information(false, color.Value, outputLine); + Output.Write(outputLine, OutputLevel.Information, color.Value); } else { - Output.Information(false, outputLine); + Output.Write(outputLine, OutputLevel.Information); } Output.Information(false, CommandLineResources.TestRunSummaryAssemblyAndFramework, diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index e2574f2f86..d4db636f10 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -1586,7 +1586,7 @@ internal static string TestRunSummary { } /// - /// Looks up a localized string similar to - {0} {1}. + /// Looks up a localized string similar to - {0} {1}. /// internal static string TestRunSummaryAssemblyAndFramework { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 7615883a6d..1e4808fbf4 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -745,7 +745,7 @@ None - - {0} {1} + - {0} {1} Collecting hang dumps by option CollectDump with TestTimeout for Blame is not supported for this platform. diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 091a3b9c9c..a9c537603d 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index cf79a1cb85..84e784589e 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 0105566455..8673f05e98 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1682,7 +1682,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index ecee7f681b..08dd4979d9 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index f1197ec943..359f587dbd 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 2ee50a31f1..68dec3d54e 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index b6e7eb612b..d645a2eec7 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 48273b5ca8..600e065613 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 7faf889d01..839d1a867b 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1679,7 +1679,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 848dfc7428..6389f284c0 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 62ae7b3a6c..46d2f82170 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1679,7 +1679,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 7b65e03e5a..f2ccd897b2 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -870,7 +870,7 @@ Format : TestRunParameters.Parameter(name="<name>", value="<value>") - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 4668f08aab..d37030370b 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1679,7 +1679,7 @@ - - {0} {1} + - {0} {1} - {0} {1} diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 7f7abf2588..0bcc68aa0f 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1680,7 +1680,7 @@ - - {0} {1} + - {0} {1} - {0} {1} From 54aca6fe76554dfb2a372fb0b8b756b0f6b5c5ca Mon Sep 17 00:00:00 2001 From: nohwnd Date: Mon, 13 Jul 2020 14:48:57 +0200 Subject: [PATCH 25/28] Minimal output --- src/vstest.console/Internal/ConsoleLogger.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 295570394a..758eb357a7 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -852,15 +852,15 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (passedTests > 0) { - Output.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests), OutputLevel.Information, ConsoleColor.Green); + Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests)); } if (failedTests > 0) { - Output.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests), OutputLevel.Information, ConsoleColor.Red); + Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests)); } if (skippedTests > 0) { - Output.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests), OutputLevel.Information, ConsoleColor.Yellow); + Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests)); } } From 6ad0adde487e5bdce09df4210b68c441e715538e Mon Sep 17 00:00:00 2001 From: nohwnd Date: Mon, 13 Jul 2020 15:18:47 +0200 Subject: [PATCH 26/28] Fix test --- test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index a8424e1367..eeaa16aeba 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -611,7 +611,7 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); loggerEvents.WaitForEventCompletion(); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, + this.mockOutput.Verify(o => o.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, (CommandLineResources.PassedTestIndicator + "!").PadRight(8), 0.ToString().PadLeft(5), 1.ToString().PadLeft(5), @@ -623,7 +623,7 @@ public void TestResultHandlerShouldShowFailedTestsAndPassedTestsForQuietVebosity "TestSourcePassed", expectedFramework), OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, + this.mockOutput.Verify(o => o.Write(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummary, (CommandLineResources.FailedTestIndicator + "!").PadRight(8), 1.ToString().PadLeft(5), 1.ToString().PadLeft(5), From c4a52e45cfbed4547be7139ad3e07050ae92b937 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Mon, 13 Jul 2020 16:37:23 +0200 Subject: [PATCH 27/28] Write when aborting --- src/vstest.console/Internal/ConsoleLogger.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 758eb357a7..e43c836b50 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -824,6 +824,15 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) if (verbosityLevel == Verbosity.Quiet || verbosityLevel == Verbosity.Minimal) { + if (e.IsCanceled) + { + Output.Error(false, CommandLineResources.TestRunCanceled); + } + else if (e.IsAborted) + { + Output.Error(false, CommandLineResources.TestRunAborted); + } + return; } From ea8b54b40427d3306343aa228905b2b3b4177687 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Mon, 13 Jul 2020 16:42:32 +0200 Subject: [PATCH 28/28] Remove empty line --- src/vstest.console/Internal/ConsoleLogger.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index e43c836b50..846ad79c7e 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -433,7 +433,6 @@ private void TestRunStartHandler(object sender, TestRunStartEventArgs e) ValidateArg.NotNull(e, "e"); // Print all test containers. - Output.WriteLine(string.Empty, OutputLevel.Information); Output.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestSourcesDiscovered, CommandLineOptions.Instance.Sources.Count()), OutputLevel.Information); if (verbosityLevel == Verbosity.Detailed) {