nunit3-vs-adapter icon indicating copy to clipboard operation
nunit3-vs-adapter copied to clipboard

No error is reported in Text Explorer if the test assembly fails to load.

Open jnm2 opened this issue 6 years ago • 1 comments

If a missing dependency causes a FileNotFoundException in the project being tested, the adapter immediately quits without updating any test results. Is there some way it could report a failure besides the Output window?

I hate to admit it, but I think this is the third time I've gone down an hour-long rabbit trail thinking something was very wrong with the adapter before realizing what was going on.

jnm2 avatar Mar 03 '18 02:03 jnm2

  • Microsoft.NET.Test.Sdk 15.9.0
  • NUnit 3.12.0
  • NUnit3TestAdapter 3.15.0
  • Visual studio v17

Hi, @jnm2, @CharliePoole.

I have a similar problem. I use the dotnet test command to run .NET Core tests, because nunit3-console isn't compatible with .NET Core tests (#364). When NUnit cannot find the version of the package that is registered in .csproj, the following error occurs:

Exception NUnit.Engine.NUnitEngineException, Exception thrown executing tests
                 [exec] An exception occurred in the driver while loading tests.
                 [exec]    at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
                 [exec]    at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
                 [exec]    at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
                 [exec]    at NUnit.Engine.Runners.DirectTestRunner.Explore(TestFilter filter)
                 [exec]    at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
                 [exec]    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, IGrouping`2 testCases, TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 310
                 [exec]    at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 103
                 [exec] Innerexception: System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
                 [exec] File name: 'nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb'
                 [exec]    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                 [exec]    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                 [exec]    at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
                 [exec]    at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
                 [exec]    at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
                 [exec]    at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
                 [exec]    at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
                 [exec]    at NUnit.Engine.Drivers.NUnit3FrameworkDriver.CreateObject(String typeName, Object[] args)
                 [exec]    at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
                 [exec]    at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
                 [exec]
                 [exec] WRN: Assembly binding logging is turned OFF.
                 [exec] To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
                 [exec] Note: There is some performance penalty associated with assembly bind failure logging.
                 [exec] To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
                 [exec]
                 [exec] No test matches the given testcase filter `FullyQualifiedName~UnitTests` in C:\Repo\xxx\yyy.UnitTests.dll

But at the same time she does not return an error, although it should not be so.

I also tried to run tests through visual studio and it showed me that tests inconclusive and skips him.

To repeat this error simply in the folder where all the dlls are stored, download and manually place NUnit version 3.11.0.

Do you have the exact same issue or do I need to create a separate issue?

ubelmach avatar Sep 06 '19 15:09 ubelmach