| |
- AnalysisResult
- ResponseAnalyzer
-
- EvalResponseAnalyzer
- StatusResponseAnalyzer
- TimerResponseAnalyzer
class AnalysisResult |
|
A response analyzer communicates the results of its analysis using an AnalysisResult
object. |
|
Methods defined here:
- __init__(self, actionResponse, analyzerName, analysisMsg, succeeded=0)
- Constructor for the AnalysisResult class.
Keyword Arguments:
actionResponse -- The action response object resulting from the test action's execution.
analysisMsg -- The message generated by the response analyzer to describe the analysis.
succeeded -- Whether or not the test action 'succeeded,' whatever that means for the
test action.
- getActionResponse(self)
- Return the action response.
- getAnalysisMsg(self)
- Return the analysis message.
- getAnalyzerName(self)
- Return the name of the analyzer that generated this analysis result.
- getSucceeded(self)
- Return whether or not the test for this analysis result succeeded or not.
Data and non-method functions defined here:
- __doc__ = 'A response analyzer communicates the results of its analysis using an AnalysisResult\n object.'
- __module__ = 'responseanalyzer'
|
class EvalResponseAnalyzer(ResponseAnalyzer) |
|
This simple response analyzer will evaluate an expression and based on the
result will deem the test action a success or failure. You can include any
previously initialized test token in the expression as well.
Keyword Arguments:
actionResponse -- The response information from the execution of the test action.
tokenDictionary -- The current token dictionary for this test plan's execution.
Parameters:
runOnFirstExecution -- Whether or not to execute this response analyzer's
analysis on a test action's first execution.
evalExpression -- The evaluation expression. This must evaluate (using Python's
eval() method to TRUE or FALSE. You can use any elements in your expression
that you choose (numbers, strings, whatever).
Examples:
1. <param name='evalExpression'><![CDATA[$$$TOKEN1$$$ > $$$TOKEN2$$$]]></param>
2. <param name='evalExpression'><![CDATA[$$$TOKEN1$$$ == 'KEYTON']]></param>
3. <param name='evalExpression'><![CDATA[($$$TOKEN1$$$ + 1) / 2 > 0.34]]></param>
Common Use:
One common use for this response analyzer is to check to see if a token exists.
To accomplish this, you would do something like the following for the config of your
test action:
<testAction name='login'>
<path>/start.cgi</path>
<output name="SESSION_ID" processor="extractRegex">
<param name="expr" eval="0"><![CDATA[href="itemList\.cgi\?session_id=(\d*)&]]></param>
</output>
<responseAnalyzerList>
<responseAnalyzer type='EvalResponseAnalyzer'>
<param name='evalExpression'><![CDATA[$$$SESSION_ID$$$]]></param>
</responseAnalyzer>
</responseAnalyzerList>
<output name="ITEM_NUMBER" processor='extractRandomNumber'>
<param name='max'>4</param>
</output>
</testAction>
The above will attempt to extract the session id and then check to see if it is there.
You could have determined whether your session id was '12345' like this:
<testAction name='login'>
<path>/start.cgi</path>
<output name="SESSION_ID" processor="extractRegex">
<param name="expr" eval="0"><![CDATA[href="itemList\.cgi\?session_id=(\d*)&]]></param>
</output>
<responseAnalyzerList>
<responseAnalyzer type='EvalResponseAnalyzer'>
<param name='evalExpression'><![CDATA[$$$SESSION_ID$$$=='12345']]></param>
</responseAnalyzer>
</responseAnalyzerList>
<output name="ITEM_NUMBER" processor='extractRandomNumber'>
<param name='max'>4</param>
</output>
</testAction> |
|
Methods defined here:
- __init__(self, paramDictionary, runOnFirstExecution)
- Constructor for the ExpressionResponseAnalyzer base class.
Keyword Arguments:
paramDictionary -- A ParamDictionary containing entries for every param for this
response analyzer. See above for more information.
runOnFirstExecution -- Whether or not to execute this response analyzer's analysis
on the first execution of a test action.
- analyze(self, actionResponse, tokenDictionary)
- Analyze the action response. Search for the existence of any of the values provided
in srchText parameters. If no srchText parameter is found, look for the word "exception."
Keyword Arguments:
actionResponse -- The response information from the execution of the test action.
NOTE: The action response is actually not used.
tokenDictionary -- The current token dictionary for this test plan's execution.
Data and non-method functions defined here:
- __doc__ = 'This simple response analyzer will evaluate an ... \n \n '
- __module__ = 'responseanalyzer'
|
class ResponseAnalyzer |
|
The base class for the response analyzer that analyzes the response document
sent back from a server upon execution of a test action. |
|
Methods defined here:
- __init__(self, paramDictionary, runOnFirstExecution)
- Constructor for the ResponseAnalyzer base class.
Keyword Arguments:
paramDictionary -- A ParamDictionary containing entries for every param
for this response analyzer.
runOnFirstExecution -- Whether or not to execute this response analyzer's analysis
on the first execution of a test action.
- analyze(self, actionResponse, tokenDictionary)
- Analyze the response sent back from a server upon execution of a test action.
Keyword Arguments:
actionResponse -- The response information from the execution of the test action.
tokenDictionary -- The current token dictionary for this test plan's execution.
Data and non-method functions defined here:
- __doc__ = 'The base class for the response analyzer that a...k from a server upon execution of a test action.'
- __module__ = 'responseanalyzer'
|
class StatusResponseAnalyzer(ResponseAnalyzer) |
|
This response analyzer checks to make sure that one (or more) specific HTTP status
code(s) is(are) returned (usually 200).
Example of use in Puffin config file:
<responseAnalyzer src='puffin' type='StatusResponseAnalyzer'>
<param name='httpStatus'>200</param>
<param name='httpStatus'>302</param>
</responseAnalyzer> |
|
Methods defined here:
- __init__(self, paramDictionary, runOnFirstExecution)
- Constructor for the TimerResponseAnalyzer base class.
Keyword Arguments:
paramDictionary -- A ParamDictionary containing entries for every param for this
response analyzer. The following parameters are used:
httpStatus -- The HTTP status required for the test action succeeded (can
be multiple possibilities -- any of these will allow a test action to succeed).
runOnFirstExecution -- Whether or not to execute this response analyzer's analysis
on the first execution of a test action.
- analyze(self, actionResponse, tokenDictionary)
- Analyze the action response for HTTP response status. Check against all
valid values (from the httpStatusRequired param value(s)).
Keyword Arguments:
actionResponse -- The response information from the execution of the test action.
tokenDictionary -- The current token dictionary for this test plan's execution.
Data and non-method functions defined here:
- __doc__ = "This response analyzer checks to make sure that...s'>302\n \n "
- __module__ = 'responseanalyzer'
|
class TimerResponseAnalyzer(ResponseAnalyzer) |
|
This response analyzer checks to see if the test action's execution takes longer
than a specified length of time (in seconds).
Example of use in Puffin config file:
<responseAnalyzer src='puffin' type='TimerResponseAnalyzer'>
<param name='timeLimitSecs'>20</param>
</responseAnalyzer> |
|
Methods defined here:
- __init__(self, paramDictionary, runOnFirstExecution)
- Constructor for the TimerResponseAnalyzer base class.
Keyword Arguments:
paramDictionary -- A ParamDictionary containing entries for every param for this
response analyzer. The following parameters are used:
timeLimitSecs -- The time limit for the test action in seconds. If the test
action's execution takes longer than this time limit, then the test action
is a failure.
runOnFirstExecution -- Whether or not to execute this response analyzer's analysis
on the first execution of a test action.
- analyze(self, actionResponse, tokenDictionary)
- Analyze the action response's elapsed time. If this test action's execution
takes longer than the timeLimitSec value, then the test action fails.
Keyword Arguments:
actionResponse -- The response information from the execution of the test action.
tokenDictionary -- The current token dictionary for this test plan's execution.
Data and non-method functions defined here:
- __doc__ = "This response analyzer checks to see if the tes...cs'>20\n \n "
- __module__ = 'responseanalyzer'
| |