Implementing data correlation for execution
To implement data correlation during execution, set up your class that extends the
com.ibm.rational.test.lt.kernel.action.KAction
class to trigger a call into the
data correlation engine.
Before you begin
com.ibm.rational.test.lt.datacorrelation.execution.harvest.IDataHarvester
com.ibm.rational.test.lt.datacorrelation.execution.sub.IDataSub
IDataCorrelationVar
com.ibm.rational.test.lt.datacorrelation.execution.proto.IProtoActionAdapter
About this task
IKAction
interface defines the basic functionality that all kernel
actions must implement. The IKAction
interface is the base interface for all
kernel actions. The actions can represent loops, conditions, or other code constructs.To
implement data correlation during execution , codegen
writes your harvesters
and substituters into containers. To implement data correlation at execution time, codegen will
need to write your harvesters and substituters into containers. This is done by calling
LTTestTranslator.translateHarvesterContainer()
and
LTTestTranslator.translateSubstituterContainer()
at codegen time when you are
translating your action. Both of these methods live in the
com.ibm.rational.test.lt.codegen.core
plugin. These containers will need to be
added to your action and stored with your action. These containers must be added to and stored
with your action. When your actions are being executed, they must call these substituter and
datasource containers. The substituter container is called at the beginning of your action,
before you send data, and the data source container is called at the end of your action, after
you have received the data.
The Javadoc for the test execution services interfaces and classes can be accessed from the product by clicking
.Procedure
-
You must extend an extension point in
codegen.core
to get your executionIProtoActionAdapter
regisetered for playback: -
To implement the
datacorrelation.execution
plug-in extension, your plug-in must implement the com.ibm.rational.test.lt.datacorrelation.execution.IProtoActionAdapter interface. The main com.ibm.rational.test.lt.datacorrelation.execution plug-in uses the interface to call your plug-in and to get the information for the implementation.Note: This is also the plug-in that extends the DataCorrelationProtoAdapter class in thecodegen
extension point. -
To start the substitution process, in the IDataSub.substituteData() method, use
the action and hash map as parameters.
- The action that is currently active will call the com.ibm.rational.test.lt.datacorrelation.execution.sub.IDataSub.substituteData() method. The substitution container executes all substitution rules and put the new string values (read from data correlation variables) into the hashMap. The first value of the hashMap is the propertyType, and the second value is the entire new string for that propertyType. So, when the substitution is done, it fixes the entire string for you.
- The substitute container returns the control to the IKAction interface.
- The IKAction interface reads the string values from the hash map and sends them to the appropriate places.
-
To start data harvesting, the action that is currently active calls the
IDataHarvester.harvestData() method. The action passes itself to the container.
- The data harvester calls the plug-in that has extended the data correlation execution plug-in to get the string values that the harvest rules must be applied to.
- The data harvester container places the harvested values into data correlation variables. These data correlation variables are then used in later substitute executions.