Correlating Java Scripts

VuGen's Java recorder attempts to automatically correlate statements in the generated script. It only performs correlation on Java objects. When it encounters a Java primitive (byte, character, boolean, integer, float, double, short, and long) during recording, the argument values appear in the script without association to variables. VuGen automatically correlates all objects, arrays of objects, and arrays of primitives. Note that Java arrays and strings are also considered objects.

VuGen employs several levels of correlation: Standard, Enhanced, and Strings. You enable or disable correlations from the Recording options. An additional method of Serialization can be used to handle scripts where none of the former methods can be applied.

Standard Correlation

Standard correlation refers to the automatic correlation performed during recording for simple objects, excluding object arrays, vectors, and container constructs.

When the recorded application invokes a method that returns an object, VuGen's correlation mechanism records these objects. When you run the script, VuGen compares the generated objects to the recorded objects. If the objects match, the same object is used. The following example shows two CORBA objects my_bank and my_account. The first object, my_bank, is invoked; the second object, my_account, is correlated and passed as a parameter in final line of the segment:

public class Actions {
  // Public function: init 
      public int init() throws Throwable {
       Bank my_bank = bankHelper.bind("bank", "pumpkin");
       Account my_account = accountHelper.bind("account","pumpkin");
       my_bank.remove_account(my_account);
      }
}

Back to top

Advanced Correlation

Advanced or deep correlation refers to the automatic correlation performed during recording for complex objects, such as object arrays and CORBA container constructs.

The deep correlation mechanism handles CORBA constructs (structures, unions, sequences, arrays, holders, `any's) as containers. This allows it to reference inner members of containers, additional objects, or different containers. Whenever an object is invoked or passed as a parameter, it is also compared against the inner members of the containers.

In the following example, VuGen performs deep correlation by referencing an element of an array. The remove_account object receives an account object as a parameter. During recording, the correlation mechanism searches the returned array my_accounts and determines that its sixth element should be passed as a parameter.

public class Actions {
   // Public function: init 
   public int init() throws Throwable {
      my_banks[] = bankHelper.bind("banks", "pumpkin");
      my_accounts[] = accountHelper.bind("accounts","pumpkin");
      my_banks[2].remove_account(my_accounts[6]);
    }
}

The following segment further illustrates enhanced correlation. The script invokes the send_letter object that received an address type argument. The correlation mechanism retrieves the inner member, address, in the sixth element of the my_accounts array.

public class Actions {
   // Public function: init 
   public int init() throws Throwable {
      my_banks = bankHelper.bind("bank", "pumpkin");
      my_accounts = accountHelper.bind("account", "pumpkin");
      my_banks[2].send_letter(my_accounts[6].address);
    }
}

Back to top

String Correlation

String correlation refers to the representation of a recorded value as an actual string or a variable. When you disable string correlation (the default setting), the actual recorded value of the string is indicated explicitly within the script. When you enable string correlation, it creates a variable for each string, allowing you to use it at a later point in the script.

In the following segment, string correlation is enabled—you store the value returned from the get_id method in a string type variable for use later on in the script.

public class Actions {
   // Public function: init 
   public int init() throws Throwable {
      my_bank = bankHelper.bind("bank", "pumpkin");
      my_account1 = accountHelper.bind("account1", "pumpkin");
      my_account2 = accountHelper.bind("account2", "pumpkin");
      string = my_account1.get_id();
      string2 = my_account2.get_id();
      my_bank.transfer_money(string, string2);
    }
}

Back to top