DataDictionary Class
A Data Dictionary is a collection of key value pairs where key is used to extract a value. Every virtual user in a running test has a Data Dictionary. Suppose a Data Dictionary contains a key "counter" whose value is 22. Then to extract the value from the dictionary use the following code:
int count = getInt("counter"); // count is now set to 22
OR:
string count = getString("counter"); // count is now set to "22"
A DataDictionary can be populated from a Data Dictionary File. This is a text file containing lines of text key=value. For example:
host = 192.168.2.7
port = 1245
user = Jane Smith
password = myPassword
eggPlant Performance Studio enables you to associate Data Dictionary Files with a Test. The key value pairs in the files are loaded in to each virtual user's data dictionary when the test is initialized. Studio also allows you to add key value pairs using the In-line Data Dictionary of a Test. You may also add key values within your script code using the add() or setXXX() methods described in this class's API reference.
The methods described in this section can all be called directly from within the code of any script class as the base script class, VirtualUserScript inherits DataDictionary. For example:
int count = getInt("count", 2000);
// count now has the integer value found in the dictionary
// OR 2000
string name = getString("name");
// name now has the string value found in the dictionary
// OR a NoSuchValueException is thrown
DataDictionary is an abstract class and all methods are pure virtual. The class SimpleDataDictionary is the most simple class that implements DataDictionary. Internally, all name value pairs within the class SimpleDataDictionary are held in a map.