public class DatapoolScriptSupport
extends java.lang.Object
RationalTestScript
. In general if no datapool is
associated with this script these methods will return a null
value or
throw an appropriate exception. You can always use the dpFactory()
method to get the singleton object for the active
datapool factory
.
Refer to the datapool package
documentation for a
discussion on how to iterate over datapool contents manually.
Modifier and Type | Field and Description |
---|---|
static int |
DP_ALL
Flag to iterate over all remaining records in the datapool iterator.
|
static int |
DP_DEFAULT_EQUIVALENCE_CLASS
Flag to use the default equivalence class.
|
static int |
DP_SHARE_CURRENT_RECORD
Flag to share the current record in the datapool iterator.
|
Constructor and Description |
---|
DatapoolScriptSupport() |
Modifier and Type | Method and Description |
---|---|
boolean |
dpBoolean(int variableIndex)
Shortcut to the
boolean value in the cell in the current record and
the specified variable index is returned. |
boolean |
dpBoolean(java.lang.String variableName)
Shortcut to the
boolean value in the cell in the current row and
the specified variable name is returned. |
boolean |
dpBoolean(java.lang.String variableName,
boolean defaultValue)
Shortcut to the
boolean value in the cell in the current record and
the specified variable name is returned. |
byte |
dpByte(int variableIndex)
Shortcut to the
byte value in the cell in the current record and
the specified variable index is returned. |
byte |
dpByte(java.lang.String variableName)
Shortcut to the
byte value in the cell in the current row and
the specified variable name is returned. |
byte |
dpByte(java.lang.String variableName,
byte defaultValue)
Shortcut to the
byte value in the cell in the current record and
the specified variable name is returned. |
char |
dpChar(int variableIndex)
Shortcut to the
int value in the cell in the current record and
the specified variable index is returned. |
char |
dpChar(java.lang.String variableName)
Shortcut to the
char value in the cell in the current row and
the specified variable name is returned. |
char |
dpChar(java.lang.String variableName,
char defaultValue)
Shortcut to the
byte value in the cell in the current record and
the specified variable name is returned. |
IDatapoolRecord |
dpCurrent()
The record currently available from the iterator for the associated
instance of the datapool.
|
boolean |
dpDone()
|
double |
dpDouble(int variableIndex)
Shortcut to the
double value in the cell in the current record and
the specified variable index is returned. |
double |
dpDouble(java.lang.String variableName)
Shortcut to the
double value in the cell in the current row and
the specified variable name is returned. |
double |
dpDouble(java.lang.String variableName,
double defaultValue)
Shortcut to the
double value in the cell in the current record and
the specified variable name is returned. |
IDatapoolFactory |
dpFactory()
Exposes the underlying the factory object so that
IDatapool instances can be opened without direct support
from the script editor. |
float |
dpFloat(int variableIndex)
Shortcut to the
float value in the cell in the current record and
the specified variable index is returned. |
float |
dpFloat(java.lang.String variableName)
Shortcut to the
float value in the cell in the current row and
the specified variable name is returned. |
float |
dpFloat(java.lang.String variableName,
float defaultValue)
Shortcut to the
float value in the cell in the current record and
the specified variable name is returned. |
void |
dpInitialization(java.io.File datapoolFile,
int equivalenceClassIndex,
java.lang.String iteratorClassName)
Initialization of the default datapool iterator used by this instance of
RationalTestScript . |
void |
dpInitialization(java.lang.Object datapool,
java.lang.Object iterator)
Initialization of the default datapool iterator used by this instance of
RationalTestScript . |
void |
dpInitialize(IDatapool datapool,
int equivalenceClassIndex,
int iterationCount)
Initialization of the default datapool iterator used by this instance of
RationalTestScript . |
int |
dpInt(int variableIndex)
Shortcut to the
int value in the cell in the current record and
the specified variable index is returned. |
int |
dpInt(java.lang.String variableName)
Shortcut to the
int value in the cell in the current row and
the specified variable name is returned. |
int |
dpInt(java.lang.String variableName,
int defaultValue)
Shortcut to the
int value in the cell in the current record and
the specified variable name is returned. |
long |
dpLong(int variableIndex)
Shortcut to the
long value in the cell in the current record and
the specified variable index is returned. |
long |
dpLong(java.lang.String variableName)
Shortcut to the
long value in the cell in the current row and
the specified variable name is returned. |
long |
dpLong(java.lang.String variableName,
long defaultValue)
Shortcut to the
Long value in the cell in the current record and
the specified variable name is returned. |
void |
dpNext()
Increments the iterator associated with an instance of the datapool.
|
void |
dpReset()
Restart the iterator associated with an instance of the datapool.
|
short |
dpShort(int variableIndex)
Shortcut to the
short value in the cell in the current record and
the specified variable index is returned. |
short |
dpShort(java.lang.String variableName)
Shortcut to the
short value in the cell in the current row and
the specified variable name is returned. |
int |
dpShort(java.lang.String variableName,
short defaultValue)
Shortcut to the
short value in the cell in the current record and
the specified variable name is returned. |
java.lang.String |
dpString(int variableIndex)
Shortcut to the
String value in the cell in the current record and
the specified variable index is returned. |
java.lang.String |
dpString(java.lang.String variableName)
Shortcut to the
String value in the cell in the current record and
the specified variable name is returned. |
java.lang.String |
dpString(java.lang.String variableName,
java.lang.String defaultValue)
Shortcut to the
String value in the cell in the current record and
the specified variable name is returned. |
void |
dpTermination(boolean terminatedByException)
Unload the datapool and datapool iterator used by this script.
|
java.lang.Object |
dpValue(int variableIndex)
Shortcut to the value in the cell in the
current record and
the specified variable index is returned. |
java.lang.Object |
dpValue(java.lang.String variableName)
Shortcut to the value in the cell in the
current record and
the specified variable name is returned. |
java.lang.Object |
dpValue(java.lang.String variableName,
java.lang.Object value)
Shortcut to the value in the cell in the
current record and
the specified variable name is returned. |
IDatapool |
getDatapool()
The datapool being iterated over.
|
boolean |
getDatapoolEncrypted() |
boolean |
getDatapoolEncryptionStatus() |
java.util.List<IDatapoolVariable> |
getEncryptedVariables() |
void |
setCurrentdp(DatapoolScriptSupport current)
For internal use.
|
void |
setDatapool(java.lang.String variableName,
java.lang.Object value)
This function sets the specified value for the specified column
of the current datapool iterator.
|
void |
storeDatapool()
If the datapool is modified across the run, this can be used to store
the changes into the file.
|
void |
unsetDatapool()
RFT 8.1.1 support multiple datapools.
|
public static final int DP_ALL
public static final int DP_SHARE_CURRENT_RECORD
public static final int DP_DEFAULT_EQUIVALENCE_CLASS
public IDatapoolFactory dpFactory()
IDatapool
instances can be opened without direct support
from the script editor.IDatapoolFactory
public void dpInitialization(java.io.File datapoolFile, int equivalenceClassIndex, java.lang.String iteratorClassName)
RationalTestScript
. This is an internal method
that should not be directly used by a script.public boolean getDatapoolEncryptionStatus()
public void dpInitialization(java.lang.Object datapool, java.lang.Object iterator)
RationalTestScript
. This is an internal method
that should not be directly used by a script.public void dpTermination(boolean terminatedByException)
public void dpInitialize(IDatapool datapool, int equivalenceClassIndex, int iterationCount)
RationalTestScript
. This is an internal method
that should not be directly used by a script.public void setCurrentdp(DatapoolScriptSupport current)
current
- public void unsetDatapool()
Example:
setDatapool("Script3.dp2",false,3);
for (int i=0; i<3; i++)
{
password().click(atPoint(40,14));
password().setText(dpString("Password"));
nameCombo().select(dpString("nameCombo"));
dpNext();
}
unsetDatapool();
public IDatapool getDatapool()
null
is returned.public IDatapoolRecord dpCurrent()
next method
. A value of null
is
returned when the iterator is out of values.public boolean dpDone()
dpCurrent()
,
dpNext()
,
dpReset()
public void dpNext()
dpCurrent()
,
dpDone()
,
dpReset()
public void dpReset()
dpCurrent()
,
dpDone()
,
dpNext()
public java.lang.Object dpValue(int variableIndex)
current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.current
record and
at the specified index.dpValue(String)
public java.lang.Object dpValue(java.lang.String variableName)
current
record and
the specified variable name is returned.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.current
record and
the specified variable name.dpValue(int)
public java.lang.Object dpValue(java.lang.String variableName, java.lang.Object value)
current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.variableName
- The variable name to locate the cell by.current
record and
the specified variable name.dpValue(int)
public java.lang.String dpString(int variableIndex)
String
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.current
record and
at the specified index.dpString(String)
public java.lang.String dpString(java.lang.String variableName)
String
value in the cell in the current
record and
the specified variable name is returned.
If the value in the cell is not a String
value then it is
converted to a String
before being returned.
An exception is thrown if this script does not have an associated datapool.
variableName
- The valiable name to locate the cell by.String
value in the cell in the current
record and
the specified variable name.dpString(int)
public java.lang.String dpString(java.lang.String variableName, java.lang.String defaultValue)
String
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a String
value then it is
converted to a String
before being returned.variableName
- The variable name to locate the cell by.current
record and
the specified variable name.public long dpLong(int variableIndex)
long
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.current
record and
at the specified index.dpLong(String)
public long dpLong(java.lang.String variableName)
long
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a long
value then an attempt
is made to convert the value to a long
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.long
value in the cell in the current
row and
the specified variable name.dpLong(int)
public long dpLong(java.lang.String variableName, long defaultValue)
Long
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a long
value then an attempt
is made to convert the value to a long
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.current
record and
the specified variable name.public int dpInt(int variableIndex)
int
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a int
value then an attempt
is made to convert the value to a int
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.int
value in the cell in the current
record and
at the specified index.dpInt(String)
public int dpInt(java.lang.String variableName)
int
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a int
value then an attempt
is made to convert the value to a int
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.int
value in the cell in the current
row and
the specified variable name.dpInt(int)
public int dpInt(java.lang.String variableName, int defaultValue)
int
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a int
value then an attempt
is made to convert the value to a int
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public short dpShort(int variableIndex)
short
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a short
value then an attempt
is made to convert the value to a short
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.short
value in the cell in the current
record and
at the specified index.dpShort(String)
public short dpShort(java.lang.String variableName)
short
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a short
value then an attempt
is made to convert the value to a short
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.short
value in the cell in the current
row and
the specified variable name.dpShort(int)
public int dpShort(java.lang.String variableName, short defaultValue)
short
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a short
value then an attempt
is made to convert the value to a short
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public byte dpByte(int variableIndex)
byte
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a byte
value then an attempt
is made to convert the value to a byte
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.byte
value in the cell in the current
record and
at the specified index.dpByte(String)
public byte dpByte(java.lang.String variableName)
byte
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a byte
value then an attempt
is made to convert the value to a byte
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.byte
value in the cell in the current
row and
the specified variable name.dpByte(int)
public byte dpByte(java.lang.String variableName, byte defaultValue)
byte
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a byte
value then an attempt
is made to convert the value to a byte
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public double dpDouble(int variableIndex)
double
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a double
value then an attempt
is made to convert the value to a double
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.double
value in the cell in the current
record and
at the specified index.dpDouble(String)
public double dpDouble(java.lang.String variableName)
double
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a double
value then an attempt
is made to convert the value to a double
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.double
value in the cell in the current
row and
the specified variable name.dpDouble(int)
public double dpDouble(java.lang.String variableName, double defaultValue)
double
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a double
value then an attempt
is made to convert the value to a double
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public float dpFloat(int variableIndex)
float
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a float
value then an attempt
is made to convert the value to a float
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.float
value in the cell in the current
record and
at the specified index.dpFloat(String)
public float dpFloat(java.lang.String variableName)
float
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a float
value then an attempt
is made to convert the value to a float
. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.float
value in the cell in the current
row and
the specified variable name.dpFloat(int)
public float dpFloat(java.lang.String variableName, float defaultValue)
float
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a float
value then an attempt
is made to convert the value to a float
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public boolean dpBoolean(int variableIndex)
boolean
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a boolean
value then an attempt
is made to convert the value to a boolean
. If the value can not
be converted an appropriate exception will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.boolean
value in the cell in the current
record and
at the specified index.dpBoolean(String)
public boolean dpBoolean(java.lang.String variableName)
boolean
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a boolean
value then an attempt
is made to convert the value to a boolean
. If the value can not
be converted an appropriate exception will be thrown.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.boolean
value in the cell in the current
row and
the specified variable name.dpBoolean(int)
public boolean dpBoolean(java.lang.String variableName, boolean defaultValue)
boolean
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a boolean
value then an attempt
is made to convert the value to a boolean
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public char dpChar(int variableIndex)
int
value in the cell in the current
record and
the specified variable index is returned. The variable index is the specified zero
based index for the cell.
If the value in the cell is not a char
value then an attempt
is made to convert the value to a char
. If more then one
character is represented in the value only the first character will be
returned.
An exception is thrown if this script does not have an associated datapool.
variableIndex
- The zero based index of the cell in the record.char
value in the cell in the current
record and
at the specified index.dpChar(String)
public char dpChar(java.lang.String variableName)
char
value in the cell in the current
row and
the specified variable name is returned.
If the value in the cell is not a char
value then an attempt
is made to convert the value to a char
. If more then one
character is represented in the value only the first character will be
returned.
An exception is thrown if this script does not have an associated datapool.
variableName
- The variable name to locate the cell by.char
value in the cell in the current
row and
the specified variable name.dpChar(int)
public char dpChar(java.lang.String variableName, char defaultValue)
byte
value in the cell in the current
record and
the specified variable name is returned. If the specified variable name is not present
or the datapool is not present, the default value that is passed is returned.
If the value in the cell is not a byte
value then an attempt
is made to convert the value to a byte
before being returned. If the value can not
be converted a java.lang.NumberFormatException
will be thrown.variableName
- The variable name to locate the cell by.defaultValue
- The default value that should be returned if the variable
doesn't exist in the datapool.current
record and
the specified variable name.public void setDatapool(java.lang.String variableName, java.lang.Object value)
variableName
- The column name of the datapoolvalue
- The value that needs to be set for the specified columnstoreDatapool()
public void storeDatapool()
public boolean getDatapoolEncrypted()
public java.util.List<IDatapoolVariable> getEncryptedVariables()