You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2014/10/07 21:48:05 UTC
svn commit: r1629969 - in /jmeter/trunk:
test/src/org/apache/jmeter/engine/util/TestValueReplacer.java
xdocs/usermanual/component_reference.xml
Author: fschumacher
Date: Tue Oct 7 19:48:04 2014
New Revision: 1629969
URL: http://svn.apache.org/r1629969
Log:
Bug 57032 - Make regexes in HTTP Script Recorder more useful.
Add a note and a testcase about overlapping matches
Bugzilla Id: 57032
Modified:
jmeter/trunk/test/src/org/apache/jmeter/engine/util/TestValueReplacer.java
jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified: jmeter/trunk/test/src/org/apache/jmeter/engine/util/TestValueReplacer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/engine/util/TestValueReplacer.java?rev=1629969&r1=1629968&r2=1629969&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/engine/util/TestValueReplacer.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/engine/util/TestValueReplacer.java Tue Oct 7 19:48:04 2014
@@ -92,6 +92,18 @@ public class TestValueReplacer extends J
assertEquals("${bounded_regex}", args.get(0).getStringValue());
}
+ public void testOverlappingMatches() throws Exception {
+ TestPlan plan = new TestPlan();
+ plan.addParameter("longMatch", "servername");
+ plan.addParameter("shortMatch", ".*");
+ ValueReplacer replacer = new ValueReplacer(plan);
+ TestElement element = new TestPlan();
+ element.setProperty(new StringProperty("domain", "servername.domain"));
+ replacer.reverseReplace(element, true);
+ String replacedDomain = element.getPropertyAsString("domain");
+ assertEquals("${${shortMatch}", replacedDomain);
+ }
+
public void testReplace() throws Exception {
ValueReplacer replacer = new ValueReplacer();
replacer.setUserDefinedVariables(variables.getUserDefinedVariables());
Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1629969&r1=1629968&r2=1629969&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Tue Oct 7 19:48:04 2014
@@ -6196,6 +6196,10 @@ but retain the trailing <code>/</code> i
Note that the current version of Jakara ORO does not support look-behind - i.e. <code>(?&lt;=...)</code> or <code>(?&lt;!...)</code>.
</note>
+<p>Look out for overlapping matchers. For example the value <code>.*</code> as a regex in a variable named
+<code>regex</code> will partly match a previous replaced variable, which will result in something like
+<code>${{regex}</code>, which is most probably not the desired result.</p>
+
<p>If there are any problems interpreting any variables as patterns, these are reported in jmeter.log,
so be sure to check this if UDVs are not working as expected.</p>