<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    qileilove

    blog已經轉移至github,大家請訪問 http://qaseven.github.io/

    jmeter 之后置處理器

    18.8.5 BeanShell PostProcessor

    The BeanShell PreProcessor allows arbitrary code to be applied after taking a sample.

    For JMeter versions after 2.2 the BeanShell Post-Processor no longer ignores samples with zero-length result data

    For full details on using BeanShell, please see the BeanShell website.

    The test element supports the ThreadListener and TestListener methods. These should be defined in the initialisation file. See the file BeanShellListeners.bshrc for example definitions.

    Control Panel

    Parameters

    AttributeDescriptionRequired
    NameDescriptive name for this element that is shown in the tree. The name is stored in the script variable LabelNo
    Reset bsh.Interpreter before each callIf this option is selected, then the interpreter will be recreated for each sample. This may be necessary for some long running scripts. For further information, see Best Practices - BeanShell scripting .Yes
    ParametersParameters to pass to the BeanShell script. The parameters are stored in the following variables:
    • Parameters - string containing the parameters as a single variable
    • bsh.args - String array containing parameters, split on white-space
    No
    Script fileA file containing the BeanShell script to run. The file name is stored in the script variable FileNameNo
    ScriptThe BeanShell script. The return value is ignored.Yes (unless script file is provided)

     

    The following BeanShell variables are set up for use by the script:

    • log - (Logger) - can be used to write to the log file
    • ctx - ( JMeterContext ) - gives access to the context
    • vars - ( JMeterVariables ) - gives read/write access to variables: vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
    • props - (JMeterProperties - class java.util.Properties) - e.g. props.get("START.HMS"); props.put("PROP1","1234");
    • prev - ( SampleResult ) - gives access to the previous SampleResult
    • data - (byte [])- gives access to the current sample data

    For details of all the methods available on each of the above variables, please check the Javadoc

    If the property beanshell.postprocessor.init is defined, this is used to load an initialisation file, which can be used to define methods etc for use in the BeanShell script.

    18.8.6 BSF PostProcessor

    The BSF PostProcessor allows BSF script code to be applied after taking a sample.

    Control Panel

    Parameters

    AttributeDescriptionRequired
    NameDescriptive name for this element that is shown in the tree.No
    LanguageThe BSF language to be usedYes
    ParametersParameters to pass to the script. The parameters are stored in the following variables:
    • Parameters - string containing the parameters as a single variable
    • args - String array containing parameters, split on white-space
    No
    Script fileA file containing the script to run, if a relative file path is used, then it will be relative to directory referenced by "user.dir" System propertyNo
    ScriptThe script to run.Yes (unless script file is provided)

     

    The script (or file) is processed using the BSFEngine.exec() method, which does not return a value.

    Before invoking the script, some variables are set up. Note that these are BSF variables - i.e. they can be used directly in the script.

    • log - (Logger) - can be used to write to the log file
    • Label - the String Label
    • Filename - the script file name (if any)
    • Parameters - the parameters (as a String)
    • args[] - the parameters as a String array (split on whitespace)
    • ctx - ( JMeterContext ) - gives access to the context
    • vars - ( JMeterVariables ) - gives read/write access to variables: vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object()); vars.getObject("OBJ2");
    • props - (JMeterProperties - class java.util.Properties) - e.g. props.get("START.HMS"); props.put("PROP1","1234");
    • prev - ( SampleResult ) - gives access to the previous SampleResult (if any)
    • sampler - (Sampler)- gives access to the current sampler
    • OUT - System.out - e.g. OUT.println("message")

    For details of all the methods available on each of the above variables, please check the Javadoc


    18.9.8 Debug PostProcessor

    The Debug PostProcessor creates a subSample with the details of the previous Sampler properties, JMeter variables, properties and/or System Properties.

    The values can be seen in the View Results Tree Listener Response Data pane.

    Control Panel

    Parameters

    AttributeDescriptionRequired
    NameDescriptive name for this element that is shown in the tree.No
    JMeter PropertiesWhether to show JMeter properties (default false).Yes
    JMeter VariablesWhether to show JMeter variables (default false).Yes
    Sampler PropertiesWhether to show Sampler properties (default true).Yes
    System PropertiesWhether to show System properties (default false).Yes


    18.8.8 JDBC PostProcessor

    The JDBC PostProcessor enables you to run some SQL statement just after a sample has run. This can be useful if your JDBC Sample changes some data and you want to reset state to what it was before the JDBC sample run.



    See Also:

     

    In the linked test plan,"JDBC PostProcessor" JDBC PostProcessor calls a stored procedure to delete from Database the Price Cut-Off that was created by PreProcessor.

     


    JDBC PostProcessor

     

     

     


    8.8.4 Result Status Action Handler

    This test element allows the user to stop the thread or the whole test if the relevant sampler failed.

    Control Panel

    Parameters

    AttributeDescriptionRequired
    NameDescriptive name for this element that is shown in the tree.No
    Action to be taken after a Sampler errorDetermines what happens if a sampler error occurs, either because the sample itself failed or an assertion failed. The possible choices are:
    • Continue - ignore the error and continue with the test
    • Start next thread loop - does not execute samplers following the sampler in error for the current iteration and restarts the loop on next iteration
    • Stop Thread - current thread exits
    • Stop Test - the entire test is stopped at the end of any current samples.
    • Stop Test Now - the entire test is stopped abruptly. Any current samplers are interrupted if possible.
    No

    18.8.3 XPath Extractor

    This test element allows the user to extract value(s) from structured response - XML or (X)HTML - using XPath query language.

    Control Panel

    Parameters

    AttributeDescriptionRequired
    NameDescriptive name for this element that is shown in the tree.No
    Apply to:This is for use with samplers that can generate sub-samples, e.g. HTTP Sampler with embedded resources, Mail Reader or samples generated by the Transaction Controller.
    • Main sample only - only applies to the main sample
    • Sub-samples only - only applies to the sub-samples
    • Main sample and sub-samples - applies to both.
    • JMeter Variable - assertion is to be applied to the contents of the named variable
    XPath matching is applied to all qualifying samples in turn, and all the matching results will be returned.
    Yes
    Use Tidy (tolerant parser)If checked use Tidy to parse HTML response into XHTML.
    • "Use Tidy" should be checked on for HTML response. Such response is converted to valid XHTML (XML compatible HTML) using Tidy
    • "Use Tidy" should be unchecked for both XHTML or XML response (for example RSS)
    Yes
    QuietSets the Tidy Quiet flagIf Tidy is selected
    Report ErrorsIf a Tidy error occurs, then set the Assertion accordinglyIf Tidy is selected
    Show warningsSets the Tidy showWarnings optionIf Tidy is selected
    Use NamespacesIf checked, then the XML parser will use namespace resolution. Note that currently only namespaces declared on the root element will be recognised. A later version of JMeter may support user-definition of additional workspace names. Meanwhile, a work-round is to replace: 
    //mynamespace:tagname 
    by 
    //*[local-name()='tagname' and namespace-uri()='uri-for-namespace'] 
    where "uri-for-namespace" is the uri for the "mynamespace" namespace. (not applicable if Tidy is selected)
    If Tidy is not selected
    Validate XMLCheck the document against its schema.If Tidy is not selected
    Ignore WhitespaceIgnore Element Whitespace.If Tidy is not selected
    Fetch External DTDsIf selected, external DTDs are fetched.If Tidy is not selected
    Return entire XPath fragment instead of text content?If selected, the fragment will be returned rather than the text content. 
    For example //title would return "<title>Apache JMeter</title>" rather than "Apache JMeter". 
    In this case, //title/text() would return "Apache JMeter".
    Yes
    Reference NameThe name of the JMeter variable in which to store the result.Yes
    XPath QueryElement query in XPath language. Can return more than one match.Yes
    Default ValueDefault value returned when no match found. It is also returned if the node has no value and the fragment option is not selected.No

     

    To allow for use in a ForEach Controller, the following variables are set on return:

    • refName - set to first (or only) match; if no match, then set to default
    • refName_matchNr - set to number of matches (may be 0)
    • refName_n - n=1,2,3 etc. Set to the 1st, 2nd 3rd match etc.

    Note: The next refName_n variable is set to null - e.g. if there are 2 matches, then refName_3 is set to null, and if there are no matches, then refName_1 is set to null.

    XPath is query language targeted primarily for XSLT transformations. However it is usefull as generic query language for structured data too. See XPath Reference or XPath specification for more information. Here are few examples:

    /html/head/title
    extracts title element from HTML response
    /book/page[2]
    extracts 2nd page from a book
    /book/page
    extracts all pages from a book
    //form[@name='countryForm']//select[@name='country']/option[text()='Czech Republic'])/@value
    extracts value attribute of option element that match text 'Czech Republic' inside of select element with name attribute 'country' inside of form with name attribute 'countryForm'

     

    When "Use Tidy" is checked on - resulting XML document may slightly differ from original HTML response:
    • All elements and attribute names are converted to lowercase
    • Tidy attempts to correct improperly nested elements. For example - original (incorrect) ul/font/li becomes correct ul/li/font
    See Tidy homepage for more information.

     

    18.8.1 Regular Expression Extractor

    Allows the user to extract values from a server response using a Perl-type regular expression. As a post-processor, this element will execute after each Sample request in its scope, applying the regular expression, extracting the requested values, generate the template string, and store the result into the given variable name.

    Control Panel

    Parameters

    AttributeDescriptionRequired
    NameDescriptive name for this element that is shown in the tree.No
    Apply to:This is for use with samplers that can generate sub-samples, e.g. HTTP Sampler with embedded resources, Mail Reader or samples generated by the Transaction Controller.
    • Main sample only - only applies to the main sample
    • Sub-samples only - only applies to the sub-samples
    • Main sample and sub-samples - applies to both.
    • JMeter Variable - assertion is to be applied to the contents of the named variable
    Matching is applied to all qualifying samples in turn. For example if there is a main sample and 3 sub-samples, each of which contains a single match for the regex, (i.e. 4 matches in total). For match number = 3, Sub-samples only, the extractor will match the 3rd sub-sample. For match number = 3, Main sample and sub-samples, the extractor will match the 2nd sub-sample (1st match is main sample). For match number = 0 or negative, all qualifying samples will be processed. For match number > 0, matching will stop as soon as enough matches have been found.
    Yes
    Response Field to checkThe following response fields can be checked:
    • Body - the body of the response, e.g. the content of a web-page (excluding headers)
    • Body (unescaped) - the body of the response, with all Html escape codes replaced. Note that Html escapes are processed without regard to context, so some incorrect substitutions may be made.

       

      Note that this option highly impacts performances, so use it only when absolutely necessary and be aware of its impacts

       

    • Body as a Document - the extract text from various type of documents via Apache Tika (see View Results Tree Document view section).

       

      Note that Body as a Document option can impact performances, so ensure it is Ok for your test

       

    • Headers - may not be present for non-HTTP samples
    • URL
    • Response Code - e.g. 200
    • Response Message - e.g. OK
    Headers can be useful for HTTP samples; it may not be present for other sample types.
    Yes
    Reference NameThe name of the JMeter variable in which to store the result. Also note that each group is stored as [refname]_g#, where [refname] is the string you entered as the reference name, and # is the group number, where group 0 is the entire match, group 1 is the match from the first set of parentheses, etc.Yes
    Regular ExpressionThe regular expression used to parse the response data. This must contain at least one set of parentheses "()" to capture a portion of the string, unless using the group $0$. Do not enclose the expression in / / - unless of course you want to match these characters as well.Yes
    TemplateThe template used to create a string from the matches found. This is an arbitrary string with special elements to refer to groups within the regular expression. The syntax to refer to a group is: '$1$' to refer to group 1, '$2$' to refer to group 2, etc. $0$ refers to whatever the entire expression matches.Yes
    Match No.Indicates which match to use. The regular expression may match multiple times.
    • Use a value of zero to indicate JMeter should choose a match at random.
    • A positive number N means to select the nth match.
    • Negative numbers are used in conjunction with the ForEach controller - see below.
    Yes
    Default ValueIf the regular expression does not match, then the reference variable will be set to the default value. This is particularly useful for debugging tests. If no default is provided, then it is difficult to tell whether the regular expression did not match, or the RE element was not processed or maybe the wrong variable is being used.

    However, if you have several test elements that set the same variable, you may wish to leave the variable unchanged if the expression does not match. In this case, remove the default value once debugging is complete.

    No, but recommended

     

    If the match number is set to a non-negative number, and a match occurs, the variables are set as follows:

    • refName - the value of the template
    • refName_gn, where n=0,1,2 - the groups for the match
    • refName_g - the number of groups in the Regex (excluding 0)
    If no match occurs, then the refName variable is set to the default (unless this is absent). Also, the following variables are removed:
    • refName_g0
    • refName_g1
    • refName_g

     

    If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:

    • refName_matchNr - the number of matches found; could be 0
    • refName_n, where n = 1,2,3 etc - the strings as generated by the template
    • refName_n_gm, where m=0,1,2 - the groups for match n
    • refName - always set to the default value
    • refName_gn - not set
    Note that the refName variable is always set to the default value in this case, and the associated group variables are not set.

    See also Response Assertion for some examples of how to specify modifiers, and for further information on JMeter regular expressions.

     


    posted on 2014-03-06 11:10 順其自然EVO 閱讀(2873) 評論(0)  編輯  收藏 所屬分類: jmeter

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導航

    統計

    常用鏈接

    留言簿(55)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 久久久久亚洲AV成人片| 亚洲综合无码AV一区二区 | 亚洲色无码专区在线观看| 国产亚洲欧美在线观看| 日韩毛片免费在线观看| 色偷偷亚洲男人天堂| 全黄性性激高免费视频| kk4kk免费视频毛片| 亚洲精品~无码抽插| 91老湿机福利免费体验| 亚洲毛片基地4455ww| 国内大片在线免费看| 污视频网站免费在线观看| 久久精品国产精品亚洲人人| 国产午夜成人免费看片无遮挡| 亚洲综合一区二区精品导航| 一二三四在线播放免费观看中文版视频| 亚洲中文字幕无码中文| 亚洲av无码乱码在线观看野外| 国产精品hd免费观看| 久久精品国产亚洲77777| 久久WWW色情成人免费观看| 国内成人精品亚洲日本语音 | 国产精品亚洲五月天高清| 亚洲视频人成在线播放| 无码国产精品一区二区免费式芒果| 99人中文字幕亚洲区| 全免费a级毛片免费**视频| 免费看一级高潮毛片| 久久精品国产亚洲AV麻豆网站 | 亚洲欧洲国产综合AV无码久久| 免费国产美女爽到喷出水来视频| 久久精品免费大片国产大片| 亚洲免费福利视频| 亚洲AⅤ永久无码精品AA| 91短视频在线免费观看| 小说专区亚洲春色校园| 亚洲人成在线电影| 国产一级一片免费播放i| 久久国产精品免费观看| 噜噜综合亚洲AV中文无码|