How to run parallel tests with C#-NUnit?
Hey Richard,
For NUnit – Parallelism is possible at the level of Children (child tests are executed in parallel with other tests), Fixtures (descendants of test till the level of Test Fixtures can execute in parallel), Self (test itself can be executed in parallel with other tests), and All (test & its descendants can execute in parallel with others at the same level).
[Parallelizable(ParallelScope.Children)] [Parallelizable(ParallelScope.Fixtures)] [Parallelizable(ParallelScope.Self)] [Parallelizable(ParallelScope.All)]
Sample code snippet:
namespace ParallelLTSelenium
{
[TestFixture("chrome", "72.0", "Windows 10")]
[TestFixture("internet explorer", "11.0", "Windows 10")]
[TestFixture("Safari", "11.0", "macOS High Sierra")]
[TestFixture("MicrosoftEdge", "18.0", "Windows 10")]
[Parallelizable(ParallelScope.All)]
public class ParallelLTTests
{
ThreadLocal<IWebDriver> driver = new ThreadLocal<IWebDriver>();
private String browser;
private String version;
private String os;
public ParallelLTTests(String browser, String version, String os)
{
this.browser = browser;
this.version = version;
this.os = os;
}