Qtp 简明教程
QTP - Datatables
数据表(类似于 Microsoft Excel)帮助测试者创建可以用于多次运行操作的数据驱动测试用例。有两种数据表 −
A DataTable, similar to Microsoft Excel, helps the testers to create data-driven test cases that can be used to run an Action multiple times. There are two types of Datatables −
-
Local DataTable − Each action has its own private datatable, also known as local datatable, which is can also be accessed across actions.
-
Global DataTable − Each test has one global data sheet that is accessible across actions.
数据表可以从 QTP 的“数据”选项卡中访问,如下所示 −
The data sheet can be accessed from the "Data" Tab of QTP as shown below −
要对指定的迭代次数执行一个测试用例,可以在测试设置对话框中设置全局数据表的迭代,可以通过文件→设置→运行(选项卡)访问,如下所示 -
To execute a test case for some specified number of iterations, one can set the iterations of global datatable in the Test Settings dialog, that can be accessed using File → Settings → Run(Tab) as shown below −
Example
例如,如果用户希望对可以通过 http://easycalculation.com/compound-interest.php 访问的“复合利息” http://easycalculation.com/ 进行参数化。可以创建参数,如下所示。数据表中也可以使用 Excel 的大多数功能。
For example, if a user wants to parameterize "compound Interest" of http://easycalculation.com/ that can be accessed using http://easycalculation.com/compound-interest.php. The Parameters can be created as shown below. Most of the functionalities of Excel can be used in Data table as well.
DataTable Operations
有三种类型的对象可以访问 DataTable。DataTable 操作可以通过遍历以下内容来很好地理解 -
There are three types of objects to access DataTable. DataTable operations can be well understood by traversing through the following −
Sr.No. |
Object Type & Description |
1 |
Data Table MethodsGives detailed information about the data table methods. |
2 |
DTParameter Object MethodsGives detailed information about the DTParameter methods. |
3 |
DTSheet Object MethodsGives detailed information about the DTSheet methods. |