如何使用SeleniumWebDriver(Java)的使用TestNG来运行特定的顺序测试类? [英] How to run the test classes in particular order using SeleniumWebDriver(Java) with TestNG?

查看:918
本文介绍了如何使用SeleniumWebDriver(Java)的使用TestNG来运行特定的顺序测试类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在使用TestNG的特定顺序运行硒的webdriver(Java)的测试类。

I want to run the Selenium WebDriver (Java) test classes in the particular order using TestNG.

有关如。我有3类,为Test1,Test2的和Test3的。我想在订单的Test2,Test1的和Test3的运行。是否有可能不进行分组?

For eg. I have 3 classes such as Test1, Test2 and Test3. I want to run in the order Test2, Test1 and Test3. Is it possible without grouping?

我尝试以下方法,但我在自己的顺序(排名不分先后)。

I tried the following way, but I runs in its own order (Alphabetical order).

<suite name="MyTestSuite" verbose="4">

<test name="MyTest">
   <classes>
        <class name="com.mypackage.Test2" />
        <class name="com.mypackage.Test1" />
        <class name="com.mypackage.Test3" />
   </classes>
</test>

是否有任何其他方式做到这一点?不进行分组这可能吗?

Is there any other way to do this? Without grouping is this possible?

推荐答案

只需使用的 preserve阶=真正的的制作班在给定的顺序执行。

Just use preserve-order="true" to make classes to run in given order.

<suite name="MyTestSuite" verbose="4">

<test name="MyTest" >
   <classes preserve-order="true">
        <class name="com.mypackage.Test2" />
        <class name="com.mypackage.Test1" />
        <class name="com.mypackage.Test3" />
   </classes>
</test>

这篇关于如何使用SeleniumWebDriver(Java)的使用TestNG来运行特定的顺序测试类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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