lundi 3 septembre 2018

Running tests in parallel locally using Selenium C# and NUnit

Need to run tests in parallel in different browsers. I have 2 test classes: BaseTest with SetUp and class with tests (a small project just to understand the implementation of the task).

I implemented running tests in different browsers by adding switch(browser) construction (e.g. switch(browser): case "chrome": driver = new ChromeDriver();) to BaseTest and [Parallelizable(ParallelScope.Fixtures)] attribute to Test class, it helped to run the tests sequentially in parallel in chrome and firefox.

Now I need to do that in several threads, I'm trying to use [Parallelizable(ParallelScope.All)] attribute, seems it helps, but there's a bunch of problems: 1) the Teardown method doesn't always work 2) a simple test (open URL and verify its title) may be failed on Assert, but it works good when it's running sequentially. When analyzing the exception it turned out that the test uses ExpectedTitle of another test (randomly). How is it possible?

Is there any possibility to run tests in multiple threads on a local machine without such a kind of problems? Would be grateful for examples.

Aucun commentaire:

Enregistrer un commentaire