Difference in test worker behaviour when specifying --workers:8

345 views
Skip to first unread message

Paul Hicks

unread,
Jan 17, 2016, 6:30:09 PM1/17/16
to NUnit-Discuss
I have many large suites of parallel tests (assembly-level Parallelizable(ParallelScope.Fixtures), LevelOfParallelism not specified).
I have an 8-core CPU.
When I run my tests via "nunit3-console --workers:8", it all behaves as expected (the errors are due to multithreading issues that I'm currently working through):

====
Run Settings
    InternalTraceLevel: Verbose
    WorkDirectory: c:\workspace\Testing
    NumberOfTestWorkers: 8
    Verbose: True

Test Run Summary
   Overall result: Failed
  Tests run: 14169, Passed: 13876, Errors: 292, Failures: 1, Inconclusive: 0
    Not run: 0, Invalid: 0, Ignored: 0, Explicit: 0, Skipped: 0
 Start time: 2016-01-17 22:58:39Z
   End time: 2016-01-17 23:00:55Z
   Duration: 135.444 seconds
====

When I run it without specifying --workers at all, I expect the same thing, since the default number of workers for my CPU is 8. However it is running all tests in a single worker thread (I can see this by inspecting the InternalTrace...log file):

====
Run Settings
    InternalTraceLevel: Verbose
    WorkDirectory: c:\workspace\Testing
    Verbose: True
    NumberOfTestWorkers: 8

Test Run Summary
    Overall result: Passed
   Tests run: 14169, Passed: 14169, Errors: 0, Failures: 0, Inconclusive: 0
     Not run: 0, Invalid: 0, Ignored: 0, Explicit: 0, Skipped: 0
  Start time: 2016-01-17 23:23:01Z
    End time: 2016-01-17 23:27:04Z
    Duration: 243.566 seconds
====

The test run is almost twice as long when running in a single thread.. :(
I guess I have set something somewhere that says "by default, use only one worker even if more than one is created", or similar.
What could it be and how do I make the default command line use the listed number of test workers?

(Point of interest: the order of run settings in the summary output is different too; Verbose comes before NumberOfTestWorkers when I run without --workers, and it comes after when I run it with --workers. Could be a hint for someone?)

Charlie Poole

unread,
Jan 19, 2016, 12:49:43 AM1/19/16
to NUnit-Discuss
Hi Paul,

The only reason you would not get the default value of 8 that I can
think of is if you use the --debug option. Are you quite sure that
only one thread is being used?

Charlie
> --
> You received this message because you are subscribed to the Google Groups
> "NUnit-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nunit-discus...@googlegroups.com.
> To post to this group, send email to nunit-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/nunit-discuss.
> For more options, visit https://groups.google.com/d/optout.

Paul Hicks

unread,
Jan 19, 2016, 6:38:05 PM1/19/16
to NUnit-Discuss
Hi Charlie,

Yes, pretty sure. Every line in the InternalTrace.<pid>.<assemblyName>.log file that is relevant says either "WorkItemDispatcher: Directly executing <testName>" or "TestWorker: Worker#1 executing <testName>". When I use the same command line with --workers:8, then I also get "TestWorker: Worker#2 executing <testName>" through "TestWorker: Worker#8 executing <testName>".

For now I'm happy to specify --workers:8. If I find the problem then I'll update this thread with details on whatever I've done wrong :)

Cheers!
Reply all
Reply to author
Forward
0 new messages