test_user
test_user

Reputation: 69

Limit number of parallel threads in NUnit Project

I am running selenium test in parallel in an NUnit project and want to limit the number of test that are run at a time

Solution I found says to specify:[assembly: LevelOfParallelism(N)] to AssemblyInfo.cs, but my NUnit project does not have an AssemblyInfo.cs

I want to limit number of selenium test run executed in parallel in NUnit project

Upvotes: 4

Views: 6024

Answers (2)

MattGrabowski
MattGrabowski

Reputation: 57

Note: you can always add an AssemblyInfo.cs to your NUnit project. Just add a file named AssemblyInfo.cs at the top level, and you can add any assembly flags there.

Upvotes: -2

Johnny
Johnny

Reputation: 9529

The documentation says might, it is not mandatory to be in AssemblyInfo.cs:

The following code, which might be placed in AssemblyInfo.cs


You could add [assembly:LevelOfParallelism(3)] to your test fixture .cs file. Take a look more about assembly attribute here.

using System;

[assembly: LevelOfParallelism(3)]

namespace YourNamespace
{
    [TestFixture]
    public class YourTextFixture
    {
    }
}

Upvotes: 5

Related Questions