Parallel Execution Features¶
To start a parallel test run, you simply need to change the testThreadCount property in your srProfile to a number higher than 1. How your tests are executed then depends on the testThreadIsolation property.
The three supported modes are:
- AppDomain
- Process
- SharedAppDomain
AppDomain¶
This is the default mode. Each test thread is executed in a separate AppDomain. These AppDomains are created at the beginning of the test run, and are reused for the rest of the test run.
Pros¶
Executed tests are isolated by the AppDomain border, so you do not have problems with static data.
Cons¶
Limited when you have shared data on a process level (e.g. SQLite in-memory dbs)
Process¶
This mode has been supported since version 1.2. A separate executor process is created for each test thread and is used to execute the tests. This is necessary if your application contains entities that exists once per process, e.g. SQLite’s in-memory database. These processes are started at the beginning of the test run, and are reused for the rest of the test run.
This mode is also used if you run your tests using the .NET 2.0 framework or for a different processor architecture.
To keep your test run short, I would recommend settings testThreadCount to (CPU Cores – 1). The remaining core is then kept free for the actual test runner process to manage the other executor processes.
Pros¶
Completely process-based separation of executed tests
Cons¶
Slower due to the additional cost of starting the test execution processes and inter-process communication