| |
- executeMySQLQuery(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor executes a query against a MySQL database. It is fairly simple
and needs more work. But it is a start.
You can execute a DDL or a DML script. Obviously, a query can return either no
rows of data, a single row of data, multiple rows of data, or a single value.
This processor allows for all three possibilities.
NOTE: It is unique among processors in that it stores results in two different
tokens, both namable by you. The first is the number of rows affected by the
execution of the query's execution. The second is a list of rows resulting from
the execution of the query.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
CONNECTION SPECIFIC:
host -- string, host to connect to or NULL pointer (localhost)
user -- string, user to connect as or NULL pointer (your username)
passwd -- string, password to use or NULL pointer (no password)
db -- (REQUIRED) string, database to use or NULL (no DB selected)
port -- integer, TCP/IP port to connect to or default MySQL port
unix_socket -- string, location of unix_socket to use or use TCP
client_flags -- integer, flags to use or 0 (see MySQL docs)
connect_time -- number of seconds to wait before the connection
attempt fails.
compress -- if set, compression is enabled
init_command -- command which is run once the connection is created
read_default_file -- see the MySQL documentation for mysql_options()
read_default_group -- see the MySQL documentation for mysql_options()
queryStatement -- (REQUIRED) The actual statement to execute...
RETURN VALUE(s) SPECIFIC:
numRowsAffectedTokenName -- (OPTIONAL Default=NUM_ROWS_AFFECTED) The
name of the token into which you want Puffin to store the number
rows affected by executing your query.
colNameListTokenName -- (OPTIONAL Default=COL_NAMES_STRING) The name
of the token into which Puffin will place a comma-delimited
string of the column names for the rows your execution returns.
rowIndex -- (OPTIONAL Default=-1 --> ALL) The index of the row you
want Puffin to return if you only want one. The index numbering
starts at 0.
colIndex -- (OPTIONAL Default=-1 --> ALL) The index of the col you
want Puffin to return if you only want one. The index numbering
starts at 0.
NOTE: This processor handles individual rows like this. If the result of
your query is a row like the following:
1 Keyton Weissinger
2 Sam Smith
3 Bill Tallman
You will receive a list of strings constructed by combining the
field values with NULL values (chr(0)).
1KeytonWeissinger
2SamSmith
3BillTallman
UNLESS you enter a rowIndex AND a colIndex, in which case, you will
receive a single value.
- extractCalculationResult(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor executes a "calculation" (basically any Python statement) and returns
the results.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
calculationFormula -- The calculation formula to evaluate for a value:
EX)
<param name='calculationFormula'><![CDATA[$$$TOKEN1$$$ + $$$TOKEN2$$$]]></param>
The above parameter would trigger puffin to retrieve the value of token1, add it to the value
of token2, and then store the result in the token specified in the storageToken parameter.
- extractHeader(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- Extract a specific header value from the list of headers returned upon
execution of the test action.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
headerName -- Which header to retrieve.
headerPrefix -- (OPTIONAL) Allows you to retrieve a specific header (the one beginning with headerPrefix)
if there are more than one header with the same name as headerName.
- extractListItem(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor retrieves an indexed element from a listToken's list.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
listToken -- This is the name of a token containing a list of values.
listIndex -- This is the index of the value in the list from listToken above you wish
to retrieve.
- extractRegex(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- Extract a specific value from the output using regular expression.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
expr -- The regular expression to search for in the action response.
- extractRegexList(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- Extract a specific value from the output using regular expression.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
expr -- The regular expression to search for in the action response.
- extractXpath(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- Extract a specific value from the output using an Xpath expression.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
xpathExpr -- The actual XPath expression this can be straight text or a CDATA
element.
xpathType -- What does the XPath expression result in:
ATTRIB_VALUE -- The value of a single attribute. No more parsing required.
NODE_VALUE -- The value must be retrieved from the first node in the node list
returned from the execution of the XPath expression.
NODE_ATTRIBUTE_VALUE -- The XPath expression's execution results in a node list
you must retrieve a specific node from the node list and from that node
retrieve a specific attribute's value.
attribName -- For NODE_ATTRIBUTE_VALUE, this indicates the attribute whos value you
wish to extract.
index -- For NODE_ATTRIBUTE_VALUE and NODE_VALUE, this indicates the specific node
from the resulting node list whose value you wish to extract. If not present,
this defaults to 0.
- generateRandomNumber(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor generates a random number based on the parameters sent in.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
max -- (REQUIRED) The upper limit for the random number.
seed -- (OPTIONAL) The seed for the random number.
- generateRandomString(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor generates a random string of characters.
You can either generate a string of a given length with a given character type.
OR
You can generate a random string based on a pattern template string you send in.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
type -- The type of character to use in generating a random string. The options are
# -- Number 0-9
_ -- Letter a-z or A-Z
? -- Number or Letter
% -- Any non-alphanumeric (!@#$^%&, etc)
* -- Any character.
NOTE: The 'type' parameter is optional. Default is '*'.
length -- The length of random string to generate. (Optional -- Defaults to 10.)
pattern -- A template upon which to generate a random string. This template can use
any of the above type characters. For example, the following would generate
a random email address: "____@_____.com" (NOTE: There are 5 '_' characters on
either side of the '@'.) This would generate a random email of a 5 letter name,
followed by a random 5 letter domain name, followed by '.com'.
If a pattern parameter is sent, both type and length are ignored.
- getCmdExecResult(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor executes a command line command and returns its results.
It is meant to allow for the use of other scripts to be run from within Puffin
and to get the results of that script. For example, if you have a Perl script
that you like that generates random names, you could use this processor.
NOTE: The return can only be simple data. It will result in a string in Puffin.
NOTE: Do not start unending processes/daemons this way. They will hang Puffin.
The example included with Puffin simply calls a Python script but this is mostly
because I like Python. You could just as easily have run a Perl or shell script
or even something like a 'ping' command. Anything, so long as it comes back with
some value and ends.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
commandLine -- The string to use on the command line.
- replaceTokens(expression, tokenDictionary)
- Replace each token (specified with the prefix '$$$' and the suffix '$$$') with the
actual value of the token. For example, if the expression is :
"Hello $$$USER_NAME$$$. How are you?"
Then this method grabs the value of the USER_NAME token and replaces the
$$$USER_NAME$$$ with this value.
Keyword Arguments:
expression -- The text or regular expression.
tokenDictionary -- The current token dictionary.
- sampleProcessTokenValue(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This shell suggests what token processors should look like.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
- selectRandomString(tokenDictionary, paramDictionary, defaultValue, actionResponse=None)
- This processor selects a random string from a list of strings.
Keyword Arguments:
tokenDictionary -- The current token dictionary from the current test plan.
paramDictionary -- The <param> elements for this extractor.
defaultValue -- A default value to return if no other value can be found.
actionResponse -- The action response from the currently executing test action.
Parameters:
stringListToken -- This is a list object. Token expressions are allowed. If a stringList parameter
is present, any 'string' parameters are ignored.
**OR**
string -- (AT LEAST ONE REQUIRED) You must include at least one string from which
puffin will return you a random selection.
|