I have a Jenkins test agent that is set up to run two distinctly different test jobs that use Nunit3 Console Runner to execute the tests. Each job starts the Nunit3 Console executable on the test agent with a different test assembly. I am trying to run both Jenkins jobs in parallel, so they basically both run Nunit Console to run each of their respective test assemblies.
For some reason, I get a socket error on the second job as shown below. This occurs right after Nunit Console discovers all the tests to run and begins the test execution process:
System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:12363
10:33:41
10:33:41 --SocketException
10:33:41 No connection could be made because the target machine actively refused it 127.0.0.1:12363
10:33:41
10:33:41 Server stack trace:
10:33:41 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
10:33:41 at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
10:33:41 at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
10:33:41 at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
10:33:41 at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
10:33:41 at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
10:33:41 at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
10:33:41
10:33:41 Exception rethrown at [0]:
10:33:41 at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
10:33:41 at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
10:33:41 at NUnit.Engine.ITestAgent.Stop()
10:33:41 at NUnit.Engine.Runners.ProcessRunner.Dispose(Boolean disposing)
10:33:41 at NUnit.Engine.Runners.AbstractTestRunner.Dispose()
10:33:41 at NUnit.Engine.Runners.MasterTestRunner.Dispose(Boolean disposing)
10:33:41 at NUnit.Engine.Runners.MasterTestRunner.Dispose()
10:33:41 at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
10:33:41 at NUnit.ConsoleRunner.Program.Main(String[] args)
Here is the command-line that I am using for the NUnit Console Runner:
nunit3-console.exe testAssemblyDLL --x86 --work=.\TestOutput --timeout=1800000 --trace=Off --result="TestResult.xml"
Note that testAssemblyDLL is a different assembly for each process being run.
Is there something missing that I should be doing with the command-line arguments to nunit3-console.exe?
The console runner (actually the copy of the test engine associated with it) runs a service to which the launched agent processes subscribe. Running two console copies in parallel may (depending on a lot of factors) cause both of them to use the same endpoint.
An alternative solution would be to use the console runner once, specifying two different assemblies. Each assembly runs by default in it's own process. In the latest versions of the console runner, they will run in parallel by default. In older versions, you might need to specify some options to make that happen. If you indicate the version you are running, I can be more precise.