IBM Rational Functional Tester
Version 6.1
IBM Rational Functional Tester API Reference

Project Version 2.0

Package com.rational.test.ft.datapool

The package com.rational.test.ft.datapool provides the datapool factory and iterator classes.

See:
          Description

Class Summary
BaseDatapoolIterator The base class for the predefined RFT datapool iterators.
DatapoolFactory The DatapoolFactory is a singleton object so that IDatapool and IDatapoolIterator instances can be shared.
DatapoolFactory.IteratorClassName  
DatapoolUtilities This class provides static datapool specific utility methods.
RandomIterator The RFT iterator used when random iteration format is selected for a particular script.
SequentialIterator The RFT iterator used when sequential iteration format is selected for a particular script.
 

Package com.rational.test.ft.datapool Description

The package com.rational.test.ft.datapool provides the datapool factory and iterator classes. Datapool support is based on the Hyades datapool interface. IDatapool is the base interface for all Functional Tester datapools.

Factory Support

The datapool factory is a singleton class that provides access to an instance of a datapool or iterator class. Datapools are loaded from a file specification of an RFTDP or RFTXDP type file. Each instance may optionally be shared across multiple requests for the same datapool. Refer to the IDatapoolFactory interface for a detailed discussion of the factory capabilities.

Iterator Support

An iterator provides orderly access to records in a specific datapool. The access order is either SEQUENTIAL or RANDOM. Refer to the IDatapoolIterator interface for a detailed discussion of the datapool iterator capabilities.

Manually Iterating a Datapool

Functional Tester will automatically manage the opening and iterating of a datapool by simply associating the datapool with a specific script. However it is possible to manually control the opening and iteration over a datapool by adding several simple statements to a script.

		java.io.File dpFile = new java.io.File((String)getOption(IOptionName.DATASTORE),
									 "datapool/ClassicsDP.rftdp");
		IDatapool dp = dpFactory().load(dpFile, true);
		IDatapoolIterator dpIter = dpFactory().open(dp, null); // use default iterator class
		dpIter.dpInitialize(dp); // use default equivalence class
		while ( !dpIter.dpDone() )
		{
			// Insert actions using dpIter based references to the datapool
			itemText().setText(dpIter.dpString("Item"));
						
			dpIter.dpNext();
		}

Basically just load the datapool and datapool iterator using the datapool factory so that the objects can be shared. Initialize the iterator, basically spcifying which equivalence class should be used (in this example the default equivalence class is used). Then iterate over the datapool using the dpNext() method to increment the iterator until dpDone() is true. Note that the methods used to access cells are relative to the dpIter variable and not the methods (with the same names) that are available relative to the script instance from the DatapoolScriptSupport class. The methods in the script are for access to the datapool associated with the script only.