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 2014/03/12 22:42:47 UTC
svn commit: r1576933 - in /jmeter/trunk: bin/testfiles/Bug56243.csv
bin/testfiles/Bug56243.jmx bin/testfiles/Bug56243.xml build.xml
src/components/org/apache/jmeter/control/ForeachController.java
xdocs/changes.xml
Author: pmouawad
Date: Wed Mar 12 21:42:47 2014
New Revision: 1576933
URL: http://svn.apache.org/r1576933
Log:
Bug 56243 - Foreach works incorrectly with indexes on subsequent iterations
Bugzilla Id: 56243
Added:
jmeter/trunk/bin/testfiles/Bug56243.csv
jmeter/trunk/bin/testfiles/Bug56243.jmx
jmeter/trunk/bin/testfiles/Bug56243.xml (with props)
Modified:
jmeter/trunk/build.xml
jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java
jmeter/trunk/xdocs/changes.xml
Added: jmeter/trunk/bin/testfiles/Bug56243.csv
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Bug56243.csv?rev=1576933&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Bug56243.csv (added)
+++ jmeter/trunk/bin/testfiles/Bug56243.csv Wed Mar 12 21:42:47 2014
@@ -0,0 +1,9 @@
+Starting iteration,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+Debug RE,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+DS-123,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+Starting iteration,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+Debug RE,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+DS-123,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+Starting iteration,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+Debug RE,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
+DS-123,200,OK,TG2 1-1,text,true,1,1,1,0,PMDMBP.local
Added: jmeter/trunk/bin/testfiles/Bug56243.jmx
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Bug56243.jmx?rev=1576933&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Bug56243.jmx (added)
+++ jmeter/trunk/bin/testfiles/Bug56243.jmx Wed Mar 12 21:42:47 2014
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.12-SNAPSHOT.20140312">
+ <hashTree>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="LoadTestsFront" enabled="true">
+ <stringProp name="TestPlan.comments"></stringProp>
+ <boolProp name="TestPlan.functional_mode">false</boolProp>
+ <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="" elementType="Argument">
+ <stringProp name="Argument.name"></stringProp>
+ <stringProp name="Argument.value"></stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="TestPlan.user_define_classpath"></stringProp>
+ <stringProp name=" TestPlan.user_define_classpath"></stringProp>
+ <elementProp name=" TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ </TestPlan>
+ <hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="TG2" enabled="true">
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.num_threads">1</stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <longProp name="ThreadGroup.start_time">1187292555000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">3</stringProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1187292555000</longProp>
+ </ThreadGroup>
+ <hashTree>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <name>saveConfig</name>
+ <value class="SampleSaveConfiguration">
+ <time>false</time>
+ <latency>false</latency>
+ <timestamp>false</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>false</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ <hostname>true</hostname>
+ <threadCounts>true</threadCounts>
+ <sampleCount>true</sampleCount>
+ </value>
+ </objProp>
+ <stringProp name="filename">Bug56243.csv</stringProp>
+ </ResultCollector>
+ <hashTree/>
+ <ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Simple Data Writer" enabled="true">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <name>saveConfig</name>
+ <value class="SampleSaveConfiguration">
+ <time>false</time>
+ <latency>false</latency>
+ <timestamp>false</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>false</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ <hostname>true</hostname>
+ <threadCounts>true</threadCounts>
+ <sampleCount>true</sampleCount>
+ </value>
+ </objProp>
+ <stringProp name="filename">Bug56243.xml</stringProp>
+ </ResultCollector>
+ <hashTree/>
+ <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="Starting iteration" enabled="true">
+ <stringProp name="BeanShellSampler.query">vars.put("my_var", "-----123--456--------------------789---");</stringProp>
+ <stringProp name="BeanShellSampler.filename"></stringProp>
+ <stringProp name="BeanShellSampler.parameters"></stringProp>
+ <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp>
+ </BeanShellSampler>
+ <hashTree/>
+ <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true">
+ <stringProp name="RegexExtractor.useHeaders">false</stringProp>
+ <stringProp name="RegexExtractor.refname">number</stringProp>
+ <stringProp name="RegexExtractor.regex">\d+</stringProp>
+ <stringProp name="RegexExtractor.template">$0$</stringProp>
+ <stringProp name="RegexExtractor.default"></stringProp>
+ <stringProp name="RegexExtractor.match_number">-1</stringProp>
+ <stringProp name="Sample.scope">variable</stringProp>
+ <stringProp name="Scope.variable">my_var</stringProp>
+ </RegexExtractor>
+ <hashTree/>
+ <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug RE" enabled="true">
+ <boolProp name="displayJMeterProperties">false</boolProp>
+ <boolProp name="displayJMeterVariables">false</boolProp>
+ <boolProp name="displaySystemProperties">false</boolProp>
+ </DebugSampler>
+ <hashTree/>
+ <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Controller" enabled="true">
+ <stringProp name="ForeachController.inputVal">number</stringProp>
+ <stringProp name="ForeachController.returnVal">current_number</stringProp>
+ <boolProp name="ForeachController.useSeparator">true</boolProp>
+ <stringProp name="ForeachController.startIndex">0</stringProp>
+ <stringProp name="ForeachController.endIndex">1</stringProp>
+ </ForeachController>
+ <hashTree>
+ <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="DS-${current_number}" enabled="true">
+ <boolProp name="displayJMeterProperties">false</boolProp>
+ <boolProp name="displayJMeterVariables">false</boolProp>
+ <boolProp name="displaySystemProperties">false</boolProp>
+ </DebugSampler>
+ <hashTree/>
+ </hashTree>
+ </hashTree>
+ </hashTree>
+ </hashTree>
+</jmeterTestPlan>
Added: jmeter/trunk/bin/testfiles/Bug56243.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Bug56243.xml?rev=1576933&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Bug56243.xml (added)
+++ jmeter/trunk/bin/testfiles/Bug56243.xml Wed Mar 12 21:42:47 2014
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testResults version="1.2">
+<sample s="true" lb="Starting iteration" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="Debug RE" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="DS-123" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="Starting iteration" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="Debug RE" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="DS-123" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="Starting iteration" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="Debug RE" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+<sample s="true" lb="DS-123" rc="200" rm="OK" dt="text" sc="1" ec="0" ng="1" na="1" hn="PMDMBP.local"/>
+
+</testResults>
Propchange: jmeter/trunk/bin/testfiles/Bug56243.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1576933&r1=1576932&r2=1576933&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Wed Mar 12 21:42:47 2014
@@ -2613,6 +2613,11 @@ run JMeter unless all the JMeter jars ar
</antcall>
<antcall target="batchtest">
+ <!-- Foreach works incorrectly with indexes on subsequent iterations -->
+ <param name="batchtest.name" value="Bug56243"/>
+ </antcall>
+
+ <antcall target="batchtest">
<!-- ArrayIndexOutOfBoundsException if "sample_variable" is set in client but not server -->
<!-- This is unaffected by the bug; it just checks the script works OK in local mode -->
<param name="batchtest.name" value="Bug54685"/>
Modified: jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java?rev=1576933&r1=1576932&r2=1576933&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java Wed Mar 12 21:42:47 2014
@@ -163,6 +163,9 @@ public class ForeachController extends G
return super.isDone();
}
+ /**
+ * Tests that JMeterVariables contain inputVal_<count>, if not we can stop iterating
+ */
private boolean endOfArguments() {
JMeterContext context = getThreadContext();
String inputVariable = getInputVal() + getSeparator() + (loopCount + 1);
@@ -214,7 +217,10 @@ public class ForeachController extends G
@Override
protected Sampler nextIsNull() throws NextIsNullException {
reInitialize();
- if (endOfArguments()) {
+ // Conditions to reset the loop count
+ if (endOfArguments() // no more variables to iterate
+ ||loopCount >= getEndIndex() // we reached end index
+ ) {
// setDone(true);
resetLoopCount();
return null;
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1576933&r1=1576932&r2=1576933&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Wed Mar 12 21:42:47 2014
@@ -136,6 +136,7 @@ A workaround is to use a Java 7 update 4
<h3>Controllers</h3>
<ul>
+<li><bugzilla>56243</bugzilla> - Foreach works incorrectly with indexes on subsequent iterations </li>
</ul>
<h3>Listeners</h3>