Cannot run .Net Framework Assemblies from nunit.engine.netstandard
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 234
- Forks
- 163
- Avg merge
- 13h 32m
- Merged PRs (30d)
- 25
Description
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:
- Point the TestPackage to the test assembly using:
TestPackage testPackage = new TestPackage(testAssemblyPaths);
- Initializing the TestEngine:
_testEngine = new TestEngine();
- 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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with NUnit.Engine.Drivers.NUnitNetStandardDriver.Load and the DirectTestRunner loading path named in the stack trace. Reproduce the run using a .NET Framework 4.7.1 test assembly from a .NET Core 2.0 host, then determine whether this assembly combination is supported by the .NET Standard engine. Done means the compatibility behavior and any required limitation are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100