You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2012/12/16 21:14:36 UTC

svn commit: r1422681 - in /jmeter/trunk: docs/images/screenshots/ xdocs/images/screenshots/ xdocs/usermanual/

Author: pmouawad
Date: Sun Dec 16 20:14:34 2012
New Revision: 1422681

URL: http://svn.apache.org/viewvc?rev=1422681&view=rev
Log:
Bug 54259 - Introduce a CSS or jquery-like based Extractor
Documentation
Bugzilla Id: 54259

Added:
    jmeter/trunk/docs/images/screenshots/css_extractor_attr.png   (with props)
    jmeter/trunk/docs/images/screenshots/css_extractor_noattr.png   (with props)
    jmeter/trunk/xdocs/images/screenshots/css_extractor_attr.png   (with props)
    jmeter/trunk/xdocs/images/screenshots/css_extractor_noattr.png   (with props)
Modified:
    jmeter/trunk/xdocs/usermanual/component_reference.xml

Added: jmeter/trunk/docs/images/screenshots/css_extractor_attr.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/images/screenshots/css_extractor_attr.png?rev=1422681&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jmeter/trunk/docs/images/screenshots/css_extractor_attr.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: jmeter/trunk/docs/images/screenshots/css_extractor_noattr.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/images/screenshots/css_extractor_noattr.png?rev=1422681&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jmeter/trunk/docs/images/screenshots/css_extractor_noattr.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: jmeter/trunk/xdocs/images/screenshots/css_extractor_attr.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/images/screenshots/css_extractor_attr.png?rev=1422681&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jmeter/trunk/xdocs/images/screenshots/css_extractor_attr.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: jmeter/trunk/xdocs/images/screenshots/css_extractor_noattr.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/images/screenshots/css_extractor_noattr.png?rev=1422681&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jmeter/trunk/xdocs/images/screenshots/css_extractor_noattr.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1422681&r1=1422680&r2=1422681&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sun Dec 16 20:14:34 2012
@@ -4941,7 +4941,99 @@ generate the template string, and store 
 </p>
 </component>
 
-<component name="XPath Extractor" index="&sect-num;.8.2"  width="729" height="317" screenshot="xpath_extractor.png">
+<component name="CSS/JQuery Extractor" index="&sect-num;.8.2"  width="826" height="276" screenshot="css_extractor_attr.png">
+<description><p>Allows the user to extract values from a server response using a CSS/JQuery selector like syntax.  As a post-processor,
+this element will execute after each Sample request in its scope, applying the CSS/JQuery expression, extracting the requested nodes,
+extracting the node as text or attribute value and store the result into the given variable name.</p></description>
+<properties>
+        <property name="Name" required="">Descriptive name for this element that is shown in the tree.</property>
+        <property name="Apply to:" required="Yes">
+        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.
+        <ul>
+        <li>Main sample only - only applies to the main sample</li>
+        <li>Sub-samples only - only applies to the sub-samples</li>
+        <li>Main sample and sub-samples - applies to both.</li>
+        <li>JMeter Variable - assertion is to be applied to the contents of the named variable</li>
+        </ul>
+        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.
+        </property>
+        <property name="CSS/JQuery extractor Implementation" required="False">
+        As of JMeter 2.9, 2 implementations for CSS/JQuery based syntax are supported:
+        <ul>
+                <li><a href="http://jsoup.org/" >JSoup</a></li>
+                <li><a href="http://jodd.org/doc/lagarto/index.html" >Jodd-Lagerto (CSSelly)</a></li>
+        </ul>
+        If selector is set to empty, default implementation(JSoup) will be used.
+        </property>
+        <property name="Reference Name" required="Yes">The name of the JMeter variable in which to store the result.</property>
+        <property name="CSS/JQuery expression" required="Yes">The CSS/JQuery selector used to select nodes from the response data. 
+        Selector, selectors combination and pseudo-selectors are supported, examples:
+        <ul>
+            <li>E[foo] an E element with a "foo" attribute</li>
+            <li>ancestor child:child elements that descend from ancestor, e.g. .body p finds p elements anywhere under a block with class "body"</li>
+            <li>:lt(n): find elements whose sibling index (i.e. its position in the DOM tree relative to its parent) is less than n; e.g. td:lt(3)</li>
+            <li>:contains(text): find elements that contain the given text. The search is case-insensitive; e.g. p:contains(jsoup)</li>
+            <li>...</li>
+        </ul>
+        For more details on syntax, see:
+            <ul>
+                <li><a href="http://jsoup.org/cookbook/extracting-data/selector-syntax" >JSoup</a></li>
+                <li><a href="http://jodd.org/doc/csselly/" >Jodd-Lagerto (CSSelly)</a></li>
+            </ul>
+        </property>
+        <property name="Attribute" required="false">
+            Name of attribute (as per HTML syntax) to extract from nodes that matched the selector. If empty, then the combined text of this element and all its children will be returned.<br/>
+            This is the equivalent <a href="http://jsoup.org/apidocs/org/jsoup/nodes/Node.html#attr%28java.lang.String%29">Element#attr(name)</a> function for JSoup if an atttribute is set.<br/>
+            <figure width="826" height="275" image="css_extractor_attr.png">CSS Extractor with attribute value set</figure><br/>
+            If empty this is the equivalent of <a href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#text%28%29">Element#text()</a> function for JSoup if not value is set for attribute.
+            <figure width="825" height="275" image="css_extractor_noattr.png">CSS Extractor with no attribute set</figure>
+        </property>
+        <property name="Match No." required="Yes">Indicates which match to use.  The CSS/JQuery selector may match multiple times.  
+            <ul>
+                <li>Use a value of zero to indicate JMeter should choose a match at random.</li>
+                <li>A positive number N means to select the nth match.</li>
+                <li> Negative numbers are used in conjunction with the ForEach controller - see below.</li>
+            </ul>
+        </property>
+        <property name="Default Value" required="No, but recommended">
+        If the 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 expression did not match, or the CSS/JQuery element was not processed or maybe the wrong variable
+        is being used.
+        <p>
+        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.
+        </p> 
+        </property>
+</properties>
+<p>
+    If the match number is set to a non-negative number, and a match occurs, the variables are set as follows:
+    <ul>
+        <li>refName - the value of the template</li>
+    </ul>
+    If no match occurs, then the refName variable is set to the default (unless this is absent). 
+</p>
+<p>
+    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:
+    <ul>
+        <li>refName_matchNr - the number of matches found; could be 0</li>
+        <li>refName_n, where n = 1,2,3 etc - the strings as generated by the template</li>
+        <li>refName - always set to the default value</li>
+    </ul>
+    Note that the refName variable is always set to the default value in this case.
+</p>
+</component>
+
+<component name="XPath Extractor" index="&sect-num;.8.3"  width="729" height="317" screenshot="xpath_extractor.png">
 	<description>This test element allows the user to extract value(s) from 
 		structured response - XML or (X)HTML - using XPath
 		query language.
@@ -5032,7 +5124,7 @@ generate the template string, and store 
  
 </component>
 
-<component name="Result Status Action Handler" index="&sect-num;.8.3"  width="613" height="133" screenshot="resultstatusactionhandler.png">
+<component name="Result Status Action Handler" index="&sect-num;.8.4"  width="613" height="133" screenshot="resultstatusactionhandler.png">
    <description>This test element allows the user to stop the thread or the whole test if the relevant sampler failed.
    </description>
    <properties>
@@ -5051,7 +5143,7 @@ generate the template string, and store 
    </properties>
 </component>
 
-<component name="BeanShell PostProcessor"  index="&sect-num;.8.4"  width="655" height="306" screenshot="beanshell_postprocessor.png">
+<component name="BeanShell PostProcessor"  index="&sect-num;.8.5"  width="655" height="306" screenshot="beanshell_postprocessor.png">
 <description>
 <p>
 The BeanShell PreProcessor allows arbitrary code to be applied after taking a sample.
@@ -5097,7 +5189,7 @@ See the file BeanShellListeners.bshrc fo
 <p>If the property <b>beanshell.postprocessor.init</b> is defined, this is used to load an initialisation file, which can be used to define methods etc for use in the BeanShell script.</p>
 </component>
 
-<component name="BSF PostProcessor" index="&sect-num;.8.5"  width="634" height="357" screenshot="bsf_postprocessor.png">
+<component name="BSF PostProcessor" index="&sect-num;.8.6"  width="634" height="357" screenshot="bsf_postprocessor.png">
 <description>
 <p>
 The BSF PostProcessor allows BSF script code to be applied after taking a sample.
@@ -5138,7 +5230,7 @@ Note that these are BSF variables - i.e.
 <p>For details of all the methods available on each of the above variables, please check the Javadoc</p>
 </component>
 
-<component name="JSR223 PostProcessor" index="&sect-num;.8.6">
+<component name="JSR223 PostProcessor" index="&sect-num;.8.7">
 <description>
 <p>
 The JSR223 PostProcessor allows JSR223 script code to be applied after taking a sample.
@@ -5147,7 +5239,7 @@ For details, see the <complink name="BSF
 </description>
 </component>
 
-<component name="JDBC PostProcessor" index="&sect-num;.8.7">
+<component name="JDBC PostProcessor" index="&sect-num;.8.8">
 <description>
 <p>
 The JDBC PostProcessor enables you to run some SQL statement just after a sample has run.