0
votes

Example:

Class 1{
@test(priority=1){
 }
@test(priority=2){
 }
}

Class 2{
@test(priority=1){
}
@test(priority=2){
}
}

When I execute these classes in test suite, first @test of class 1 executes and then a new browser instance opens in which first @test of class 2 executes. Now second @test of class 1 executes and then second @test of class 2 executes. Note: Test parallel is false in this case. Need to know why this happens. I want execution of first class to complete before it starts with second. I could not figure out. I did some workaround nothing worked.

Thanks in advance.

1

1 Answers

1
votes

TestNG is working as expected: You use priority and TestNG orders tests with it.

Check the documentation about dependencies and you'll find what you are looking for.

I think you should use dependsOnMethods instead of priority (or maybe the group-by-instances feature).