Previous Topic: Data Set CharacteristicsNext Topic: Deploy a New Data Set


Create a New Data Set

Follow these steps:

  1. Create a Java class that extends com.itko.lisa.test.DataSetImpl.

    This class provides the information that is required to execute your data set logic.

    public class SomeDataSet extends DataSetImpl
     {
     }
    

    Your data set object is a Remote RMI object, and is therefore able to throw a RemoteException from its constructor and some methods.

  2. Implement the required getTypeName method.

    This method provides the name that is used to identify the companion in the Test Case Editor.

    public String getTypeName()
     {
     return "Nifty Data Set";
     }
    

    The string that the getTypeName method returns is the default name of a new data set.

  3. Implement the getParameters method.

    This method provides the parameters needed for your companion to execute. You must also call the super class implementation of this method. The Test Case Editor allows you to edit the parameters that are shown here. The parameters are given to you at the time of execution. Implement this method only if your companion requires parameters.

    public ParameterList getParameters() throws RemoteException
    {
    ParameterList pl = super.getParameters();
    // ...
    return pl;
    }
    

    For more information about Parameters and ParameterLists, see Extending DevTest Solutions.

  4. Implement the two required initialize methods.

    These methods are provided so that the data set can be initialized from either XML or the ParameterList system within DevTest.

    public void initialize(Element dataset)
     throws TestDefException
     public void initialize(ParameterList pl, TestExec ts)
     throws TestDefException
    
  5. Implement the getRecord method.

    DevTest calls this method when another row is needed from the data source for the data set. If an error occurs or you otherwise want to prevent the test from executing normally, throw a TestRunException.

    synchronized public Map getRecord()
     throws TestRunException, RemoteException
    

    If you are out of rows in the data source, you must specifically code for the two possible conditions that the user wants:

    The following example shows possible psuedo-code for this function:

    Read next row
     If no-next-row, Then
     If there is no "at end" parameter specified, Then
     Re-open the data source
     Read next row
     Else
     Return null
     Return row values
    
    

Note: The API for the DataSet interface includes the public String getType() method. This method returns the classname of the class implementing this interface.