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

Before you implement data correlation, become familiar with the following classes:
  • 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
See the Javadoc information for class and method descriptions.

About this task

The 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 Help > Help Contents > DevOps Test Performance API Reference.

Procedure

To implement the execution portion of data correlation:
  1. You must extend an extension point in codegen.core to get your execution IProtoActionAdapter regisetered for playback:
    1. Extend the extension point DataCorrelationProtoAdapter in the com.ibm.rational.test.lt.codegen.core package. To do the extension, use your plug-in that is the extension to the com.ibm.rational.test.lt.datacorrelation.execution plug-in that implements the IProtoActionAdapter interface.
    2. Tell the com.ibm.rational.test.lt.datacorrelation.execution plug-in what types of IKActions to handle and the name of your plug-in.
    3. When this is complete, you should see something similar to the following added near the top of your generated .java code:

      pa.addPA("com.ibm.rational.test.lt.sdksamples.datacorrelation.execution.socket.SocketActionAdapter", "com.ibm.rational.test.lt.sdksamples.protocol.socket.io.SocketSend"); The first string should be the name of your class that implements the IProtoActionAdapter, and the second string should be the name of the KAction that your IProtoActionAdapter class should be called for. Be very careful on the spelling, it has to be exactly right.

  2. 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 the codegen extension point.
  3. To start the substitution process, in the IDataSub.substituteData() method, use the action and hash map as parameters.
    1. 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.
    2. The substitute container returns the control to the IKAction interface.
    3. The IKAction interface reads the string values from the hash map and sends them to the appropriate places.
  4. To start data harvesting, the action that is currently active calls the IDataHarvester.harvestData() method. The action passes itself to the container.
    1. 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.
    2. The data harvester container places the harvested values into data correlation variables. These data correlation variables are then used in later substitute executions.