Skip to content

Commit

Permalink
Merge pull request #557 from nunit/prepare311-2
Browse files Browse the repository at this point in the history
Prepare311 2
  • Loading branch information
OsirisTerje committed Oct 27, 2018
2 parents 8ceaffd + c1b5f52 commit 275bb27
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
8 changes: 5 additions & 3 deletions nuget/NUnit3TestAdapter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
<iconUrl>https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>NUnit 3 adapter for running tests in Visual Studio. Works with NUnit 3.x, use the NUnit 2 adapter for 2.x tests.</summary>
<description>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.
<description>
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.</description>
The package works with Visual Studio 2012 and newer.</description>
<releaseNotes>This release works with NUnit 3.0 and higher only. Also see https://github.com/nunit/docs/wiki/Adapter-Release-Notes </releaseNotes>
<copyright>Copyright (c) 2011-2018 Charlie Poole, 2014-2018 Terje Sandstrom</copyright>
<language>en-US</language>
Expand Down
18 changes: 9 additions & 9 deletions src/NUnitTestAdapter/NUnit3TestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}

Expand All @@ -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");
}
}
}
Expand All @@ -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
{
Expand All @@ -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);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/NUnitTestAdapter/TestLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 275bb27

Please sign in to comment.