I am executing my tests in Visual Studio Enterprise 2019 version 16.3.9 / Test Explorer window. My architecture is Intel(R) Core(TM) i7-7600 CPU @ 2.80Ghz (4 CPUs), ~2.9Ghz
Here is my pseudo Selenium C# code below:
[TestFixture]
internal class TestClass{
[OneTimeSetUp]
public void OneTimeSetUp()
{
initializeExtentReport()
}
[SetUp]
public void Setup()
{
initializeChromebBrowser();
}
[Test]
public void NavigatoToGmail()
{
bool isGmailAccessible = GoToUrl("https://www.google.com/");
Assert.True(isGmailAccessible);
}
[Test]
public void NavigatoToMicrosoft()
{
bool isMicrosoftAccessible = GoToUrl("https://www.microsoft.com/");
Assert.True(isMicrosoftAccessible);
}
[Test]
public void NavigatoToYahoo()
{
bool isYahooAccessible = GoToUrl("https://www.yahoo.com/");
Assert.True(isYahooAccessible);
}
[TearDown]
public void TearDOwn()
{
CloseBrowser();
}
[OneTimeTearDown]
public void OneTimeTearDown()
{
FinishExtentReport();
}
So here is what I tried already and it didn't work
Adding
[Parallelizable(ParallelScope.Children)]
to the class and[Parallelizable(ParallelScope.Self)]
attributes to every test method. The result - 3 browser instances open with no other actions. No URL navigating, nothing.Adding
[Parallelizable(ParallelScope.All)]
to class and[Parallelizable(ParallelScope.Self)]
to every test method. The result - 3 browser instances open. Only the last test (NavigatoToYahoo) is executed and provides the result. The first 2 - no other action happens and the browser windows are not closed, meaning TearDown() method is not executed.Just adding
[Parallelizable(ParallelScope.Self)]
to every test method. The result - 3 browser instances open with no other actions. No URL navigating, nothing.Adding
[Parallelizable(ParallelScope.Self)]
to the class and[Parallelizable(ParallelScope.Self)]
attributes to every test method. The result - 3 browser instances open. The second test (NavigateToMicrosoft) gets executed, the rest 2 - no other action, no URL navigating, nothing.Adding
[Parallelizable(ParallelScope.Self)]
to the class and[Parallelizable(ParallelScope.All)]
attributes to every test method. The result - getting error messageMay not specify ParallelScope.Children on a non-parameterized test method
- honestly have no idea why
I have gone through the documentation here https://github.com/nunit/docs/wiki/Parallelizable-Attribute but I feel like there is no actual way to execute unit tests in parallel using NUnit framework.
I simply want to run those 3 tests (in my actual scenario there are about 100 of them) in parallel independent of each other.