diff --git a/NUnit3TestAdapter.sln.DotSettings b/NUnit3TestAdapter.sln.DotSettings
index 5570b4d3..2eaa4d97 100644
--- a/NUnit3TestAdapter.sln.DotSettings
+++ b/NUnit3TestAdapter.sln.DotSettings
@@ -7,6 +7,11 @@
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy>
CSharp70
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy></Policy>
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="" Suffix="" Style="aaBb" /></Policy></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ True
True
True
True
diff --git a/build.cake b/build.cake
index 8871bab0..dd5a7501 100644
--- a/build.cake
+++ b/build.cake
@@ -15,7 +15,7 @@ var configuration = Argument("configuration", "Release");
var version = "4.6.0";
-var modifier = "-beta.2";
+var modifier = "-beta.7";
var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
var packageVersion = version + modifier + dbgSuffix;
diff --git a/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs b/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs
index 80b3d863..93bdb9c8 100644
--- a/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs
+++ b/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs
@@ -123,7 +123,8 @@ public void DiscoverTests(IEnumerable sources, IDiscoveryContext discove
}
else
{
- TestLog.Warning("Exception thrown discovering tests in " + sourceAssembly, e);
+ TestLog.Error("Exception thrown discovering tests in " + sourceAssembly, e);
+ // throw; // This causes the VerifyLoading test to fail. It can't load the Empty assembly, which happens regardless of this, just when rethrowing it shows up.
}
}
catch (BadImageFormatException)
@@ -145,13 +146,19 @@ public void DiscoverTests(IEnumerable sources, IDiscoveryContext discove
catch (TypeLoadException ex)
{
if (ex.TypeName == "NUnit.Framework.Api.FrameworkController")
+ {
TestLog.Warning(" Skipping NUnit 2.x test assembly");
+ }
else
- TestLog.Warning("Exception thrown discovering tests in " + sourceAssembly, ex);
+ {
+ TestLog.Error("Exception thrown discovering tests in " + sourceAssembly, ex);
+ throw;
+ }
}
catch (Exception ex)
{
- TestLog.Warning("Exception thrown discovering tests in " + sourceAssembly, ex);
+ TestLog.Error("Exception thrown discovering tests in " + sourceAssembly, ex);
+ throw;
}
finally
{
diff --git a/src/NUnitTestAdapter/NUnit3TestExecutor.cs b/src/NUnitTestAdapter/NUnit3TestExecutor.cs
index 59756168..c1d5d4bb 100644
--- a/src/NUnitTestAdapter/NUnit3TestExecutor.cs
+++ b/src/NUnitTestAdapter/NUnit3TestExecutor.cs
@@ -31,6 +31,7 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NUnit.Engine;
using NUnit.VisualStudio.TestAdapter.Dump;
@@ -142,7 +143,7 @@ private void RunAssemblies(IEnumerable sources, TestFilter filter)
string assemblyPath = Path.IsPathRooted(assemblyName)
? assemblyName
: Path.Combine(Directory.GetCurrentDirectory(), assemblyName);
- RunAssembly(assemblyPath, null, filter);
+ RunAssembly(assemblyPath, null, filter, assemblyName);
}
catch (Exception ex)
{
@@ -205,13 +206,13 @@ public void RunTests(IEnumerable tests, IRunContext runContext, IFrame
var filterBuilder = CreateTestFilterBuilder();
var filter = filterBuilder.FilterByList(assemblyGroup);
- RunAssembly(assemblyPath, assemblyGroup, filter);
+ RunAssembly(assemblyPath, assemblyGroup, filter, assemblyName);
}
catch (Exception ex)
{
if (ex is TargetInvocationException) { ex = ex.InnerException; }
- TestLog.Warning("Exception thrown executing tests", ex);
+ TestLog.Error("Exception thrown executing tests", ex);
}
assemblytiming.LogTime($"Executing {assemblyGroup.Key} time ");
@@ -274,7 +275,8 @@ public void InitializeForExecution(IRunContext runContext, IFrameworkHandle fram
TestLog.Debug("EnableShutdown: " + enableShutdown);
}
- private void RunAssembly(string assemblyPath, IGrouping testCases, TestFilter filter)
+ private void RunAssembly(string assemblyPath, IGrouping testCases, TestFilter filter,
+ string assemblyName)
{
LogActionAndSelection(assemblyPath, filter);
RestoreRandomSeed(assemblyPath);
@@ -326,6 +328,20 @@ private void RunAssembly(string assemblyPath, IGrouping testCa
if (ex is TargetInvocationException)
ex = ex.InnerException;
TestLog.Warning(" Exception thrown executing tests in " + assemblyPath, ex);
+ var tc = new TestCase(assemblyName, new Uri(NUnit3TestExecutor.ExecutorUri), assemblyName)
+ {
+ DisplayName = assemblyName,
+ FullyQualifiedName = assemblyName,
+ Id = Guid.NewGuid(),
+ CodeFilePath = assemblyPath,
+ LineNumber = 0,
+ };
+ FrameworkHandle.RecordResult(new TestResult(tc)
+ {
+ Outcome = TestOutcome.Failed,
+ ErrorMessage = ex.ToString(),
+ ErrorStackTrace = ex.StackTrace,
+ });
}
finally
{
diff --git a/src/NUnitTestAdapterTests/TestDiscoveryTests.cs b/src/NUnitTestAdapterTests/TestDiscoveryTests.cs
index fb20d1c8..f32d713b 100644
--- a/src/NUnitTestAdapterTests/TestDiscoveryTests.cs
+++ b/src/NUnitTestAdapterTests/TestDiscoveryTests.cs
@@ -127,6 +127,7 @@ public class EmptyAssemblyDiscoveryTests : ITestCaseDiscoverySink
static readonly string EmptyAssemblyPath =
Path.Combine(TestContext.CurrentContext.TestDirectory, "empty-assembly.dll");
+ // [Ignore("This test fails in the engine when loading an empty test, with a TargetInvocationException exception")]
[TestCaseSource(typeof(TestDiscoveryDataProvider), nameof(TestDiscoveryDataProvider.TestDiscoveryData))]
public void VerifyLoading(IDiscoveryContext context)
{