2

I'm working on running NUnit console runners using Jenkins. These tests connect to a Selenium Grid (which is also run by Jenkins), so I want to limit their level of parallelism in order to avoid getting agents starving while waiting for a free node on the grid.

So far I haven't managed to figure out what exactly is the difference between an agent and a worker thread in NUnit... I suspect the agent can manage threads, but it's only a guess. Thanks :)

towel
  • 2,094
  • 1
  • 20
  • 30

1 Answers1

3

An agent is a separate process running tests for an assembly. A worker is a thread, within a process, running the tests for a particular assembly.

Theoretically, an agent process could have multiple appdomains, each domain could have multiple assemblies and each assembly could have multiple worker threads.

Practically, however, the normal thing to do is to have one process per assembly, so that there is no need for multiple domains, and each process will run some specified number of worker threads to run tests for the assembly. In some contexts, you may prefer to only run processes in parallel and not have any parallelism within the assembly - it's the approach that is most likely to work without any change to your tests, which you may not have designed with parallelism in mind.

Agents do not "manage" threads. They simply run the framework in a process and the framework decides how many threads to use depending on the attributes you have applied.

Using multiple agents is the only way to run nunit V2 tests in parallel, since the v2 framework is ignorant of parallelism.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • Thank you for the detailed answer! I use nunit V3 and each of my fixtures is self-contained, so each runner runs one assembly (i.e. one agent) and for assemblies that use the Selenium Grid I will use a fixed number of threads. – towel May 24 '17 at 06:54