È possibile adattare la API find() dinamica per leggere più pool di dati da uno script di test funzionale.
Questo codice di esempio mostra come leggere più di un pool di dati da uno script di test funzionale.
public class UserInformation extends UserInformationHelper {
/**
* Script Name : UserInformation Generated : Sep 6, 2011 3:57:48
* PM Description : Functional Test Script Original Host : WinNT Version
* 5.1 Build 2600 (S)
*
* @since 2011/09/06
* @author IBM Rational
*/
public void testMain(Object[] args) throws Exception {
//User defined function to load more then on DataPool
firstDataPool();
}
public void firstDataPool(){
//Get a value from the first datapool at the Test Script Level.
String address = dpString("Address");
System.out.println(" -- Address from the 'script' associated dataPool: " + address);
//Call the second datapool
SecondDataPool();
}
public void SecondDataPool() {
// Point to the datapool location that was created
java.io.File dpFile = new java.io.File(
(String) getOption(IOptionName.DATASTORE), "/UserDetails.rftdp");
// Load the datapool using RFT IDataPoolFactory
IDatapool dataPool_two = dpFactory().load(dpFile, true);
// Open the datapool using RFT IDataPoolFactory
IDatapoolIterator dataPool_Ite_2 = dpFactory().open(dataPool_two, null);
// After it is opened, initilize the datapool to access the data
dataPool_Ite_2.dpInitialize(dataPool_two);
// Get a value from the second datapool, first record
String firstName = dataPool_Ite_2.dpString("FirstName");
// Redirect the output to console or use logInfo method
System.out.println(" -- First Name from the Second DataPool: "
+ firstName);
}
}