From 1eaef05b97a3a7aec9ca1ff3033304c4e274a535 Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Fri, 26 Oct 2018 22:53:11 +0200 Subject: [PATCH 1/3] Added indenting to execution log messages to easier see messages that belongs together in a test run --- src/NUnitTestAdapter/NUnit3TestExecutor.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/NUnitTestAdapter/NUnit3TestExecutor.cs b/src/NUnitTestAdapter/NUnit3TestExecutor.cs index 075fe15c..5e29ea11 100644 --- a/src/NUnitTestAdapter/NUnit3TestExecutor.cs +++ b/src/NUnitTestAdapter/NUnit3TestExecutor.cs @@ -253,7 +253,7 @@ private void RunAssembly(string assemblyPath, TestFilter filter) loadedTestCases.Add(testConverter.ConvertTestCase(testNode)); - TestLog.Info($"NUnit3TestExecutor converted {loadedTestCases.Count} of {nunitTestCases.Count} NUnit test cases"); + TestLog.Info($" NUnit3TestExecutor converted {loadedTestCases.Count} of {nunitTestCases.Count} NUnit test cases"); // If we have a TFS Filter, convert it to an nunit filter if (TfsFilter != null && !TfsFilter.IsEmpty) @@ -265,7 +265,7 @@ private void RunAssembly(string assemblyPath, TestFilter filter) if (filter == NUnitTestFilterBuilder.NoTestsFound) { - TestLog.Info("Skipping assembly - no matching test cases found"); + TestLog.Info(" Skipping assembly - no matching test cases found"); return; } @@ -278,7 +278,7 @@ private void RunAssembly(string assemblyPath, TestFilter filter) catch (NullReferenceException) { // this happens during the run when CancelRun is called. - TestLog.Debug("Nullref caught"); + TestLog.Debug(" Nullref caught"); } } } @@ -287,27 +287,27 @@ private void RunAssembly(string assemblyPath, TestFilter filter) { var msgNode = loadResult.SelectSingleNode("properties/property[@name='_SKIPREASON']"); if (msgNode != null && (new[] { "contains no tests", "Has no TestFixtures" }).Any(msgNode.GetAttribute("value").Contains)) - TestLog.Info("NUnit couldn't find any tests in " + assemblyPath); + TestLog.Info(" NUnit couldn't find any tests in " + assemblyPath); else - TestLog.Info("NUnit failed to load " + assemblyPath); + TestLog.Info(" NUnit failed to load " + assemblyPath); } } catch (BadImageFormatException) { // we skip the native c++ binaries that we don't support. - TestLog.Warning("Assembly not supported: " + assemblyPath); + TestLog.Warning(" Assembly not supported: " + assemblyPath); } catch (FileNotFoundException ex) { // Probably from the GetExportedTypes in NUnit.core, attempting to find an assembly, not a problem if it is not NUnit here - TestLog.Warning("Dependent Assembly " + ex.FileName + " of " + assemblyPath + " not found. Can be ignored if not a NUnit project."); + TestLog.Warning(" Dependent Assembly " + ex.FileName + " of " + assemblyPath + " not found. Can be ignored if not a NUnit project."); } catch (Exception ex) { if (ex is TargetInvocationException) ex = ex.InnerException; - TestLog.Warning("Exception thrown executing tests in " + assemblyPath, ex); + TestLog.Warning(" Exception thrown executing tests in " + assemblyPath, ex); } finally { @@ -324,7 +324,7 @@ private void RunAssembly(string assemblyPath, TestFilter filter) // can happen if CLR throws CannotUnloadAppDomainException, for example // due to a long-lasting operation in a protected region (catch/finally clause). if (ex is TargetInvocationException) { ex = ex.InnerException; } - TestLog.Warning("Exception thrown unloading tests from " + assemblyPath, ex); + TestLog.Warning(" Exception thrown unloading tests from " + assemblyPath, ex); } } } From 438261d3e4da38ba9dfdf8701d7807466bd6064d Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Fri, 26 Oct 2018 22:57:16 +0200 Subject: [PATCH 2/3] Added possibility for a silencing info messages by setting Verbosity to <0, indicating Quiet. Then only warnings and Errors will be shown --- src/NUnitTestAdapter/TestLogger.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NUnitTestAdapter/TestLogger.cs b/src/NUnitTestAdapter/TestLogger.cs index 19feb721..b2236267 100644 --- a/src/NUnitTestAdapter/TestLogger.cs +++ b/src/NUnitTestAdapter/TestLogger.cs @@ -99,7 +99,8 @@ public void Warning(string message, Exception ex) public void Info(string message) { - SendMessage(TestMessageLevel.Informational, message); + if (adapterSettings?.Verbosity>= 0) + SendMessage(TestMessageLevel.Informational, message); } #endregion @@ -119,8 +120,7 @@ public void Debug(string message) public void SendMessage(TestMessageLevel testMessageLevel, string message) { - if (MessageLogger != null) - MessageLogger.SendMessage(testMessageLevel, message); + MessageLogger?.SendMessage(testMessageLevel, message); } public void SendMessage(TestMessageLevel testMessageLevel, string message, Exception ex) From c1b5f527ca541ff77bd6422d24e4929eecbcb86b Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Sat, 27 Oct 2018 10:18:43 +0200 Subject: [PATCH 3/3] Fixed jnm2 comment on nuspec description --- nuget/NUnit3TestAdapter.nuspec | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nuget/NUnit3TestAdapter.nuspec b/nuget/NUnit3TestAdapter.nuspec index 6bbecd64..6cd5d6eb 100644 --- a/nuget/NUnit3TestAdapter.nuspec +++ b/nuget/NUnit3TestAdapter.nuspec @@ -11,11 +11,13 @@ https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png false NUnit 3 adapter for running tests in Visual Studio. Works with NUnit 3.x, use the NUnit 2 adapter for 2.x tests. - A package including the NUnit 3 TestAdapter for Visual Studio 2012 onwards. With this package you don't need to install the VSIX adapter package, and you don't need to upload the adapter to your TFS server. + + A package including the NUnit 3 TestAdapter for Visual Studio 2012 onwards. With this package you don't need to install the VSIX adapter package, and you don't need to upload the adapter to your TFS server. -Note that this package ONLY contains the adapter, not the NUnit framework. You must also get the framework. For VS 2017 and forward you should add this package to every test project in your solution, earlier version only require a single adapter package. + Note that this package ONLY contains the adapter, not the NUnit framework. You must also get the framework. + For VS 2017 and forward, you should add this package to every test project in your solution. (Earlier versions only require a single adapter package per solution.) -The package works with Visual Studio 2012 and newer. + The package works with Visual Studio 2012 and newer. This release works with NUnit 3.0 and higher only. Also see https://github.com/nunit/docs/wiki/Adapter-Release-Notes Copyright (c) 2011-2018 Charlie Poole, 2014-2018 Terje Sandstrom en-US