Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you set Parallelizable Attribute in dotnet core for Nunit tests?

A convenient way of running tests in parallel in nunit when in a dotnet framework project was to set this in the AssemblyInfo.cs file.

[assembly: Parallelizable(ParallelScope.Fixtures)]

however in .net core or .net standard, there is no longer an AssemblyInfo.cs file. So how can one set the scope to parallel in net core or net standard in just one place, without having to add that decorator on every single test class file?

like image 914
EllaVader Avatar asked Nov 01 '18 19:11

EllaVader


People also ask

What is test attribute in NUnit?

The Test attribute is one way of marking a method inside a TestFixture class as a test. It is normally used for simple (non-parameterized) tests but may also be applied to parameterized tests without causing any extra test cases to be generated.

Does NUnit support parallel execution?

Parallel execution is supported by the NUnit framework on desktop . NET runtimes and . NET Standard 2.0.


1 Answers

Create WhateverNameYouWant.cs file. Just put your code - NUnit will recognize it.

  using NUnit.Framework;
  [assembly: Parallelizable(ParallelScope.Fixtures)]
like image 135
unickq Avatar answered Oct 19 '22 17:10

unickq