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.
To start creating a datapool, right-click on your functional test project and select Add Test Datapool.
Now give your datapool a name.
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.
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 .
To start mapping to your datapool path, right-click on the datapool and select properties.
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.
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.
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".
Read the UserName and Password in 2 Arraylist by using the function
Now you can use these two ArrayLists to perform the login recursively for the given User Id's and Passwords.
- Download the DWReadDatapool.zip file, which is the sample Rational Functional Tester project.
- Extract the zipped file to DWReadDatapool folder.
- 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.
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-