I'm using the NUnit Engine for NUnit 3 to run unit tests from my application. The method for doing so can be found in the answer to this thread "How to run a NUnit test?". This answer is exactly what I need, except when I attempt to run a test I get the following error:
"Unable to acquire remote process agent"
Stack Trace:
[Exception: Unable to acquire remote process agent]
NUnit.Engine.Runners.ProcessRunner.LoadPackage() +530
NUnit.Engine.Runners.AbstractTestRunner.Load() +22
NUnit.Engine.Runners.MasterTestRunner.LoadPackage() +291
NUnit.Engine.Runners.MasterTestRunner.NUnit.Engine.ITestRunner.Run(ITestEventListener listener, TestFilter filter) +56
Any help is greatly appreciated. Thanks.
Passing --inprocess option to nunit3-console.exe solved the problem for me.
If you are going to take this approach, you need to make sure that all of the NUnit assemblies and exe's are in your build directory. In your case, I expect that you are referencing the engine so it is getting included, but the nunit-agent.exe and the other files are likely not present.
That said, why not just use nunit3-console to run your tests, or if you need a self-executing test assembly, use the NUnitLite package. With it, you can run tests as simply as,
using NUnit.Common;
using NUnit.Framework;
using NUnitLite;
using System;
using System.Reflection;
namespace MyProject.Test
{
public class Program
{
public int Main(string[] args)
{
return new AutoRun(typeof(Program).GetTypeInfo().Assembly)
.Execute(args, new ExtendedTextWrapper(Console.Out), Console.In);
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With