testtoken (version 0.8.8, 30 April 2002)
index
c:\work\puffin\testtoken.py

Puffin allows you to insert information items, known to puffin as "Test Tokens" into an HTTP 
request or extract information from the HTTP response. These information items are 
represented by Inputs and Outputs, respectively.
 
Input tokens are single data values either retrieved from the current token dictionary,
generated from a script, or retrieved from a sequential list of values generated from a
file or a script.
 
Output tokens are ostensibly values that are extracted from the response sent back from 
the web server upon the execution of a test action (or generated from a script that may or
may not use the data in the HTTP response). However, it is important to note that outputs
can simply represent execution of code that results in a value to be placed into the
token dictionary. Also, there is nothing enforcing that an output value is a simple data 
value. An output value can be of any object type. Non-simple types can be retrieved from 
the token dictionary just as simply as a simple value.

 
Modules
            
extensions
puffinlogging
tokenprocessing
 
Classes
            
TestToken
Input
Output
TokenDictionary
 
class Input(TestToken)
      The Input class represents an input value to be sent to the the server as part of an 
HTTP request in the execution of a test action. 
 
The format of an <input> element is the following:
 
     <input name="xxxxx" type="xxxxx" processor="xxxxx" 
        src="[PUFFIN | CUSTOM]" defaultValue="xxxxx" antiActions="action1, action2,..." 
        systemFlagDepends="flag1, flag2, ..." >
        <param name="xxxxx" eval="0">xxxxxxx</param>
     </input>
    
Where:
    name -- This is the name that will be used in sending this token's value to the web app.
    type -- (OPTIONAL: Defaults to GET) What type of input: GET, POST, or HEADER.
    processor -- (OPTIONAL: Defaults to VALUE) The name of the input processor to use. This can be one of the core puffin
        input processors (DICT, FILELIST, SCRIPTLIST, and VALUE).
    src -- (OPTIONAL: Defaults to PUFFIN) Where to find the processor to use. This is "PUFFIN" for the core processors and
        "CUSTOM" for your own extensions to the puffin framework.
    defaultValue -- (OPTIONAL: Defaults to None) The value to return if no value is returned from the processor.
    antiActions -- (OPTIONAL -- Used only for AutoInputs) The names to which this input should 
        NOT be added.
    systemFlagDepends -- (OPTIONAL -- Used only for AutoInputs) The names of the various system flags which must
        be set to TRUE before this auto input will be added to the various test actions.
 
Core Input Processors:
    None.
 
   Methods defined here:
__init__(self, inputNode)
Constructor for an Input.
 
Keyword Arguments:
inputNode -- The <input> node for this input. Format:
 
    <input name="xxxxx" type="xxxxx" processor="xxxxx" 
       src="[PUFFIN | CUSTOM]" defaultValue="xxxxx" antiActions="action1, action2,..." 
       systemFlagDepends="flag1, flag2, ..." >
       <param name="xxxxx" eval="0">xxxxxxx</param>
    </input>
 
See above for more information.
getInputValue(self, tokenDictionary)
Generate the appropriate input value and return it.
 
Keyword Arguments:
tokenDictionary -- The current token dictionary for the currently executing test plan.
getNextInputValue(self, tokenDictionary)
Return the specified value from the list of values for this token.
getType(self)
Return the input type.

Data and non-method functions defined here:
__doc__ = 'The Input class represents an input value to be...n Core Input Processors:\n None.\n '
__module__ = 'testtoken'

Methods inherited from TestToken:
getActionAntiList(self)
Return the current list of anti actions (actions for whom this token is not processed.
getName(self)
Return the input name.
getSystemFlagList(self)
Return the current list of system flags that must be TRUE for this token to be processed.
 
class Output(TestToken)
      The Output class represents an output value to be retrieved at the time of 
reception of an HTTP response. The retrieval of this value may or may not involve
the HTTP response document.
 
The format of an <output> element is the following:
 
     <output name="xxxxx" processor="xxxxx" 
        src="[PUFFIN | CUSTOM]" defaultValue="xxxxx" antiActions="action1, action2,..." 
        systemFlagDepends="flag1, flag2, ..." >
        <param name="xxxxx" eval="0">xxxxxxx</param>
     </output>
    
Where:
    name -- This is the name that will be used in sending this token's value to the web app.
    processor -- (OPTIONAL: Defaults to VALUE) The name of the input processor to use. This can be one of the core puffin
        input processors (VALUE -- or the name of a processor function).
    src -- (OPTIONAL: Defaults to PUFFIN) Where to find the processor to use. This is "PUFFIN" for the core processors and
        "CUSTOM" for your own extensions to the puffin framework.
    defaultValue -- (OPTIONAL: Defaults to None) The value to return if no value is returned from the processor.
    antiActions -- (OPTIONAL -- Used only for AutoOutputs) The names of test actions to which this output should 
        NOT be added.
    systemFlagDepends -- (OPTIONAL -- Used only for AutoOutputs) The names of the various system flags which must
        be set to TRUE before this auto output will be added to the various test actions.
 
Core Input Processors:
    extractHeader -- Extracts the value of a header from the HTTP response.
    extractXpath -- Executes an XPath expression against the HTTP response and returns the result.
    extractRegex -- Executes a regular expression against the HTTP response and returns the match.
    extractRandomNumber -- Generates a random number.
    extractRandomString -- Generates a random selection from a list of strings.
    extractCalculationResult -- Evaluates a calculation formula and returns the resulting value.
 
   Methods defined here:
__init__(self, outputNode)
Constructor for an Output. Requires an output XML node in the following format:
 
   <output name="xxxxx" processor="xxxxx" 
      src="[PUFFIN | CUSTOM]" defaultValue="xxxxx" antiActions="action1, action2,..." 
      systemFlagDepends="flag1, flag2, ..." >
      <param name="xxxxx" eval="0">xxxxxxx</param>
   </output>
 
See above for more information.
getNextListValue(self, tokenDictionary, actionResponse)
Generate the appropriate output value and return it.
 
Keyword Arguments:
tokenDictionary -- The current token dictionary for the currently executed test plan.
actionResponse -- A wrapper for the HTTP response sent back by the server upon
    the execution of the test action.
getOutputValue(self, tokenDictionary, actionResponse)
Generate the appropriate output value and return it.
 
Keyword Arguments:
tokenDictionary -- The current token dictionary for the currently executed test plan.
actionResponse -- A wrapper for the HTTP response sent back by the server upon
    the execution of the test action.

Data and non-method functions defined here:
__doc__ = 'The Output class represents an output value to ...n formula and returns the resulting value.\n '
__module__ = 'testtoken'

Methods inherited from TestToken:
getActionAntiList(self)
Return the current list of anti actions (actions for whom this token is not processed.
getName(self)
Return the input name.
getSystemFlagList(self)
Return the current list of system flags that must be TRUE for this token to be processed.
 
class TestToken
      The base class for both Input and Output, the Token class provides common functionality
for both. Specifically, the Token class provides all initialization and retrieval mechanisms
for default values.
 
   Methods defined here:
__init__(self, tokenNode)
Constructor for TestToken base class.
 
Keyword Arguments:
tokenNode -- Either the <input> or <output> XML node being processed.
getActionAntiList(self)
Return the current list of anti actions (actions for whom this token is not processed.
getName(self)
Return the input name.
getSystemFlagList(self)
Return the current list of system flags that must be TRUE for this token to be processed.

Data and non-method functions defined here:
__doc__ = 'The base class for both Input and Output, the T...nd retrieval mechanisms\n for default values.'
__module__ = 'testtoken'
 
class TokenDictionary
      The token dictionary stores tokens and their associated values
for substitution. This substitution occurs in the preparation of
test actions before their execution in a test plan.
NOTE: This is implemented as a class instead of as a simple
dictionary object to allow for more complex storage/retrieval
mechanisms in the future (i.e. XML document-based storage, for 
example.).
 
   Methods defined here:
__getitem__(self, key)
Overload the getitem method so that it returns the appropriate value using getTokenValue.
 
Keyword Arguments:
key -- The key for the value you wish to retrieve.
__init__(self, startDictionary=None)
Constructor for TokenDictionary.
 
Keyword Arguments:
startDictionary -- Used to initialize the token dictionary (default=None).
__setitem__(self, key, value)
Overload the setitem method so that it sets the appropriate value using putTokenValue.
 
Keyword Arguments:
key -- The key for the value you wish to retrieve.
getTokenValue(self, tokenName, default=None)
Return the value corresponding to the token name sent in.
User appropriate custom generator code, if appropriate.
 
Keyword Arguments:
tokenName -- The name of the token whose value you are attempting to retrieve.
default -- The default value to return if the tokenName is not found.
putTokenValue(self, tokenName, tokenValue)
Add a token:value pair to the token dictionary.
 
Keyword Arguments:
tokenName -- The name of the token whose value you are attempting to set.
tokenValue -- The value to set for this token name.

Data and non-method functions defined here:
__doc__ = 'The token dictionary stores tokens and their as...XML document-based storage, for \n example.).'
__module__ = 'testtoken'
 
Data
             __author__ = 'Keyton Weissinger '
__date__ = '30 April 2002'
__file__ = '.\\testtoken.pyc'
__name__ = 'testtoken'
__status__ = 'beta'
__version__ = '0.8.8'
 
Author
             Keyton Weissinger <keyton@weissinger.org>