Skip to content

Cannot run .Net Framework Assemblies from nunit.engine.netstandard #465

Open
@clydeigc

Description

@clydeigc

I have a compiled set of .Net Framework 4.7.1 NUnit3 Tests as a DLL and would like to run them from a .Net Core 2.0 project through the NUnit.Engine.NetStandard.

What I am trying to do is:

  1. Point the TestPackage to the test assembly using:
TestPackage testPackage = new TestPackage(testAssemblyPaths);
  1. Initializing the TestEngine:
_testEngine = new TestEngine();
  1. Creating an instance of the TestRunner and call the Run() method:
using (ITestRunner testRunner = _testEngine.GetRunner(testPackage))
{
    TestFilter categoryTestFilter = builder.GetFilter();

    /* 
    NUnitTestEventMapper and NUnitEventSplitter are custom classes unrelated to this question, 
    the latter of which implements ITestEventListener.
    */
    NUnitTestEventMapper nUnitTestEventMapper = new NUnitTestEventMapper();
    testRunner.Run(new NUnitEventSplitter(subscribers, nUnitTestEventMapper), categoryTestFilter);
}

On Run, I'm getting the following Exception:

Exception Message - 'Could not load file or assembly 'MyTestAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'

Exception Stack Trace -

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at NUnit.Engine.Drivers.NUnitNetStandardDriver.Load(String testAssembly, IDictionary`2 settings)
   at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
   at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
   at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   at NUnit.Engine.Runners.TestExecutionTask.Execute()
   at NUnit.Engine.Runners.AggregatingTestRunner.RunTestsSequentially(ITestEventListener listener, TestFilter filter, List`1 results, Boolean disposeRunners)
   at NUnit.Engine.Runners.AggregatingTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   at NUnit.Engine.Runners.MasterTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   at NUnit.Engine.Runners.MasterTestRunner.Run(ITestEventListener listener, TestFilter filter)

Should it be possible at all to create a TestPackage pointing to test assemblies using .Net Framework and .Net Core and running everything using a single .Net Standard Engine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureV4All issues related to V4 or later - use -label:V4 to get V3 issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions