Automation framework using datapools

本文详细介绍了如何在Rational Functional Tester中创建数据池,以供测试脚本在回放期间获取变量值,从而提高测试流程效率。通过灵活地使用数据池,可以减少代码量并促进更有效的自动化工作。数据池允许随时更改数据,无需修改框架,增强了框架的适应性。文章还展示了如何读取和映射数据池路径,并提供了将数据池整合到自动化框架中的示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

Introduction

In the IBM® Rational® Functional Tester tool, a datapool is a collection of related data records, which supplies data values to the variables in a test script during playback. The datapool can be used in various ways in the framework to make your process more efficient; when strategically used, this capability can help reduce the code size, and assist in furthering effective automation efforts.

The data in the datapools can be changed anytime, without any need to modify your framework, which helps make your framework flexible for changes.

Creating a datapool

To start creating a datapool, right-click on your functional test project and select Add Test Datapool.

Figure 1. Creating a datapool


Now give your datapool a name.

Figure 2. Naming the datapool

Add columns (Variables) to the datapool by right-clicking the datapool pane.


Figure 3. Adding columns to the datapool

 

Add a record by right-clicking and selecting Add Record.


Figure 4. Adding records to your datapool

Finally, you should have a datapool with a column (variable) and a record.


Figure 5. Final datapool

 

How to read the datapool

Below is the code to read the datapool.


Listing 1. Code to read the datapool

By way of example, for the datapool created above you would pass the name/path of the datapool TestDatapool and the column Variable1 .

How to map the datapool path

To start mapping to your datapool path, right-click on the datapool and select properties.


Figure 6. Datapool path

 

As shown in the case above, the path for the TestDatapool will be /Project1/TestDatapool.rftdp

 

How to use the datapools in your framework

You can dynamically create the test suites to add or remove any testcase.

 

Creating TestSuites


There are two ways to create your testsuites:

  • Calling independent testscripts (where one script is for one testcase)
  • Calling the functions

Test suite creation by calling independent test scripts

Create a datapool "TestSuite" with Variables "TestCase", "TestScript" and "Execute".

Here the TestCase is the name of the testcase to be executed.

The TestScript is the call script value of the testcase (the one you get on right-click on a script and selecting insert as call script.)

Execute shows if the testcase is to be executed or not.

 

Figure 7. Sample TestSuite

Now using the function ReadDP(String DpName, String ColumnName)

Get the values for all these 3 columns in arraylists.


Listing 2. Using the datapool to create a testsuite

 

 

Use these ArrayList using the below code:

 

Test suite creation by calling functions

Similarly, you can use the datapools by adding one more column Function name. Instead of calling the script, you will call that specific function.

To Supply the test data, you can use datapools to supply the testdata to perform regression testing.

 

Datapools in action – an example

To test the login functionality for different users, you could have a Test Datapool "Login" with columns "UserName" and "Password".

 

Figure 8. Sample Testdata
 

 

Read the UserName and Password in 2 Arraylist by using the function


Listing 3. Example

Now you can use these two ArrayLists to perform the login recursively for the given User Id's and Passwords.

 

Working with the sample files

  1. Download the DWReadDatapool.zip file, which is the sample Rational Functional Tester project.
  2. Extract the zipped file to DWReadDatapool folder.
  3. Launch Rational Functional Tester, select File > Connect to a Functional Test Project, browse to the DWReadDatapool folder, and click Finish. The functional test project will open in Rational Functional Tester.

Summary

Now that you are able to create datapools using your Rational Functional Tester tool, you can leverage the Functional Tester solution's capability to supply data values to the variables in a test script during playback. The datapools that you have configured can be used in various ways in the framework to make your process more efficient; when strategically used, this capability can help reduce the code size, and assist in furthering effective automation efforts. Your process is positioned for change, with a flexible process that can adapt to your organization's growing needs.

Visit the Rational Functional Tester page to learn more about creating automation frameworks, using the downloadable zip file to help your organization create datapools.

 

you can visit the original article from url: http://www.ibm.com/developerworks/rational/library/10/automationframeworkusingdatapools/index.html?ca=dat-

 

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值