Click here to Skip to main content
15,071,519 members
Please Sign up or sign in to vote.
1.11/5 (2 votes)
See more:
how to execute test cases in sequential order in different nodes using selenium webdriver ?


What I have tried:

I tried but unable to get solution for my requirement
Posted
Updated 12-Jun-17 22:38pm

I assume you are executing test cases under Testng framework. Would you please specify what matrices you are using to execute the same.

1. If the methods are depending upon each one individual method?
2.Setting priority to execute test cases sequentially ?


For 1st one you can use dependsOnMethods : eg.

// using dependsOnMethods
@Test
public void method1(){
    // this one passes
}

@Test(dependsOnMethods = {"method1"})
public void method2(){
    fail("assume this one fails");
}

@Test(dependsOnMethods = {"method1"})
public void method3(){
    // this one runs, since it depends on method1
}

@Test(dependsOnMethods = {"method2"})
public void method4(){
    // this one is skipped, since it depends on method2
}


for the 2nd one you can set priority: eg.

@test(priority=0)
function1()
{}
@test(priority=1)
function2()
{}
@test(priority=5)
function3()
{}
@test(priority=3)
function4()
{}
@test(priority=2)
function5()
{}


In addition you have to set priority in Testng.XML for the same
   
Thanks
mrased379
for your valuable reply
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900