0
votes

i try to run few test cases in parallel and it don't work well. i want run in parallel test cases but each test case that run in parallel run with test case from anoter test and not with test case from same test.

i have 2 tests in same class and for each test i have a few test cases:

 [TestFixture] 
 [Parallelizable(ParallelScope.All)] 
 [Category("example_category")]
 public class example
 {
    [Test] 
    [TestCase(param1, param2)]   
    [TestCase(param1, param2)] 
    public void test1(object param1, object param2){
        // do some stuff
    }

    [Test] 
    [TestCase(param1, param2)]   
    [TestCase(param1, param2)] 
    public void test2(object param1, object param2){
        // do some stuff
    } 
 }

now all tests run in parallel but i get a lot of errors, what i want to do is run in parallel test cases from another tests. for example: i want test case from test1 run in parallel with test case from test2, but now 2 test case of test1 run in parallel and i want to avoid from this. how i can fix my code to do it right?

this tests is not a selenium tests, only backend tests so i don't use driver.

thanks!

1

1 Answers

0
votes

Simplest way to guarantee the behavior you want is to put the two test methods in separate fixtures. In that case, you would not want to keep using ParallelScope.All on the fixtures, since that would allow the fixtures to run together. You should use ParallelScope.Children in that case.