jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1811257 - in /jmeter/trunk/xdocs: changes.xml usermanual/component_reference.xml usermanual/functions.xml
Date Thu, 05 Oct 2017 20:28:05 GMT
Author: pmouawad
Date: Thu Oct  5 20:28:05 2017
New Revision: 1811257

URL: http://svn.apache.org/viewvc?rev=1811257&view=rev
Log:
Bug 61556 - Clarify in documentation performance impacts of ${} var usage in IfController
and groovy
Contributed by  Justin McCartney 
This closes #314
Bugzilla Id: 61556

Modified:
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml
    jmeter/trunk/xdocs/usermanual/functions.xml

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1811257&r1=1811256&r2=1811257&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Oct  5 20:28:05 2017
@@ -137,6 +137,7 @@ Summary
 
 <h3>Controllers</h3>
 <ul>
+    <li><bug>61556</bug>Clarify in documentation performance impacts of
${} var usage in IfController and groovy. Contributed by Justin McCartney (be_strew at yahoo.co.uk)</li>
 </ul>
 
 <h3>Listeners</h3>
@@ -172,6 +173,7 @@ Summary
     <li>Igor Panainte (panainte.i at gmail.com)</li>
     <li>Emilian Bold (emi at apache.org)</li>
     <li><a href="http://ubikloadpack.com">Ubik Load Pack</a></li>
+    <li>Justin McCartney (be_strew at yahoo.co.uk)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter. <br/>
 For this release we want to give special thanks to the following reporters for the clear
reports and tests made after our fixes:</p>

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1811257&r1=1811256&r2=1811257&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Oct  5 20:28:05 2017
@@ -2286,10 +2286,13 @@ Please refer to the <complink name="Cons
             <li><code>"${VAR}" == "abcd"</code></li>
         </ul>
         If there is an error interpreting the code, the condition is assumed to be <code>false</code>,
and a message is logged in <code>jmeter.log</code>.
-        <note>Note it is advised to avoid using JavaScript mode for performances</note>
+        <note>Note it is advised to avoid using JavaScript mode for performance.<br
/><br />When using <code><funclink name="__groovy"/></code> take
care to not use variable replacement in the string, otherwise if using a variable that changes
the script cannot be cached.  Instead get the variable using: <code>vars.get("myVar").</code>
 See the Groovy examples below.</note>
     </example>
     <example title="Examples (Variable Expression)" anchor="example_if_variable">
         <ul>
+            <li><code>${__groovy(vars.get("myVar") != "Invalid" )}</code>
(Groovy check myVar is not equal to Invalid)</li>
+            <li><code>${__groovy(vars.get("myInt").toInteger() &lt;=4 )}</code>
(Groovy check myInt is less then or equal to 4)</li>
+            <li><code>${__groovy(vars.get("myMissing") != null )}</code>
(Groovy check if the myMissing variable is not set)</li>
             <li><code>${__jexl3(${COUNT} &lt; 10)}</code></li>
             <li><code>${RESULT}</code></li>
             <li><code>${JMeterThread.last_sample_ok}</code> (check if the
last sample succeeded)</li>

Modified: jmeter/trunk/xdocs/usermanual/functions.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/functions.xml?rev=1811257&r1=1811256&r2=1811257&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jmeter/trunk/xdocs/usermanual/functions.xml Thu Oct  5 20:28:05 2017
@@ -964,6 +964,18 @@ The following variables are set before t
 (*) means that this is set before the init file, if any, is processed. 
 Other variables vary from invocation to invocation.
 </p>
+<note>
+When using this function please use the variables defined above rather than using string
replacement to access a variable in your script.  Following this pattern will ensure that
your tests are performant by ensuring that the Groovy can be cached.
+</note>
+<p>
+For instance <strong>don't</strong> do the following:
+</p>
+
+<p><code>${__groovy("${myVar}".substring(0\,2))}</code></p>
+
+<p>Imagine that the variable myVar changes with each transaction, the Groovy above
cannot be cached as the script changes each time.<br /><br />
+Instead do the following, which can be cached: <br /><br /><code>${__groovy(vars.get("myVar").substring(0\,2))}</code>
+</p>
 </description>
 
 <properties>
@@ -979,7 +991,7 @@ Other variables vary from invocation to
 Example:
 <dl>
 <dt><code>${__groovy(123*456)}</code></dt><dd>returns <code>56088</code></dd>
-<dt><code>${__groovy("${var}".substring(0\,2))}</code></dt><dd>If
var's value is <code>JMeter</code>, it will return <code>JM</code>
as it runs <code>String.substring(0,2)</code>. Note
+<dt><code>${__groovy(vars.get("myVar").substring(0\,2))}</code></dt><dd>If
var's value is <code>JMeter</code>, it will return <code>JM</code>
as it runs <code>String.substring(0,2)</code>. Note
 that <code>,</code> has been escaped to <code>\,</code> </dd>
 </dl>
 </p>



Mime
View raw message