nunit / nunit3-vs-adapter

NUnit 3.0 Visual Studio test adapter for use under VS 2012 or later
https://nunit.org
MIT License
203 stars 105 forks source link

Tests not run in parallel in the Visual Studio 2017 test runner #563

Closed jawn closed 5 years ago

jawn commented 5 years ago

When reporting a bug, please provide the following information to speed up triage:

Both 3.11.0

image

  1. Get the code https://github.com/jawn/dotnet-parallel-parameterized-tests/tree/repro-nunit3-parallel-testing
  2. Run these tests with the Visual Studio 2017 .NET interactive test runner after enabling this button:

Expected result: tests run in parallel

Actual result: tests run sequentially.

image

Workaround: the ReSharper test runner does run them in parallel.

.NET Framework 4.6.1

OsirisTerje commented 5 years ago

Hi ! The "Run Tests in Parallel" only controls the VSTest coarse grained container-in-parallel, not the NUnit internal parallelization options. The blogpost you refer to in the tweet, https://dev.to/franndotexe/parallel-test-execution-within-the-context-of-mstestv2-nunit3-and-vstestconsole-3f39 , also explains this, somewhat hidden though.

I tried your repro solution, and besides removing the extra unneeded packages (you only need NUnit and NUnit3TestAdapter), the tests there are running in parallel. Note however that the display of the duration for the parent node shows the sum of the underlying nodes, regardless of parallel or not. If you check it by commenting out the parallel attribute, you see the difference.

jawn commented 5 years ago

Thanks for fast feedback, @OsirisTerje!

I see now that the tests output window gives better feedback when running the Tests using the Visual Studio test explorer: [11/20/2018 10:41:43 AM Informational] ------ Run test started ------ [11/20/2018 10:41:44 AM Informational] NUnit Adapter 3.11.0.0: Test execution started [11/20/2018 10:41:44 AM Informational] Running selected tests in C:...\dotnet-parallel-parameterized-tests\netfx-nunit\Tests\bin\Debug\Tests.dll [11/20/2018 10:41:44 AM Informational] NUnit3TestExecutor converted 3 of 3 NUnit test cases [11/20/2018 10:41:51 AM Informational] NUnit Adapter 3.11.0.0: Test execution complete [11/20/2018 10:41:52 AM Informational] ========== Run test finished: 3 run (0:00:08.2039706) ==========