如何使用selenium webdriver在不同节点中按顺序执行测试用例? [英] How to execute test cases in sequential order in different nodes using selenium webdriver ?

查看:473
本文介绍了如何使用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.设置优先顺序执行测试用例?




< b>对于第一个,您可以使用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

您的宝贵回复


这篇关于如何使用selenium webdriver在不同节点中按顺序执行测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆