如何使用selenium webdriver在不同节点中按顺序执行测试用例?

如何使用selenium webdriver在不同节点中按顺序执行测试用例?

问题描述:

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

我假设您正在Testng框架下执行测试用例。你能否指出你用来执行相同的矩阵。



1。如果方法取决于每个单独的方法?

2.设置优先顺序执行测试用例?




对于第一个,您可以使用dependsOnMethods:例如。



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()
{}





另外你必须在Testng.XML中设置相同的优先级



In addition you have to set priority in Testng.XML for the same


谢谢
mrased379

您的宝贵回复