jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1852943 - in /jmeter/trunk: bin/jmeter.properties src/core/org/apache/jmeter/samplers/SampleResult.java test/src/org/apache/jmeter/samplers/TestSampleResult.java xdocs/changes.xml xdocs/usermanual/properties_reference.xml
Date Mon, 04 Feb 2019 20:19:53 GMT
Author: pmouawad
Date: Mon Feb  4 20:19:53 2019
New Revision: 1852943

URL: http://svn.apache.org/viewvc?rev=1852943&view=rev
Log:
Bug 63055 Don't rename SampleResult Label when test is running in Functional mode or property
subresults.disable_renaming=true.

Implemented by Artem Fedorov (artem.fedorov at blazemeter.com) and contributed by BlazeMeter.

This closes #439
Bugzilla Id: 63055

Modified:
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
    jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/properties_reference.xml

Modified: jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1852943&r1=1852942&r2=1852943&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.properties (original)
+++ jmeter/trunk/bin/jmeter.properties Mon Feb  4 20:19:53 2019
@@ -576,6 +576,11 @@ sampleresult.timestamp.start=true
 # Set this to <= 0 to disable the background thread
 #sampleresult.nanoThreadSleep=5000
 
+# Since version 5.0 JMeter has a new SubResult Naming Policy which numbers subresults by
default
+# This property if set to true discards renaming policy. This can be required if you're using
JMeter for functional testing.
+# Defaults to: false
+#subresults.disable_renaming=false
+
 #---------------------------------------------------------------------------
 # Upgrade property
 #---------------------------------------------------------------------------
@@ -1320,3 +1325,11 @@ jmeter.reportgenerator.apdex_tolerated_t
 # Switch that allows using Local documentation opened in JMeter GUI
 # By default we use Online documentation opened in Browser
 #help.local=false
+
+#---------------------------------------------------------------------------
+# Documentation generation
+#---------------------------------------------------------------------------
+
+# Path to XSL file used to generate Schematic View of Test Plan
+# When empty, JMeter will use the embedded one in src/core/org/apache/jmeter/gui/action/schematic.xsl
+#docgeneration.schematic_xsl=
\ No newline at end of file

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=1852943&r1=1852942&r2=1852943&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Mon Feb  4 20:19:53
2019
@@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.jmeter.assertions.AssertionResult;
 import org.apache.jmeter.gui.Searchable;
+import org.apache.jmeter.testelement.TestPlan;
 import org.apache.jmeter.threads.JMeterContext.TestLogicalAction;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.util.JOrphanUtils;
@@ -96,7 +97,9 @@ public class SampleResult implements Ser
      * @see #setDataType(java.lang.String)
      */
     public static final String BINARY = "bin"; // $NON-NLS-1$
-    
+
+    private static final boolean DISABLE_SUBRESULTS_RENAMING = JMeterUtils.getPropDefault("subresults.disable_renaming",
false);
+
     // List of types that are known to be binary
     private static final String[] BINARY_TYPES = {
         "image/",       //$NON-NLS-1$
@@ -614,8 +617,17 @@ public class SampleResult implements Ser
      *            the {@link SampleResult} to be added
      */
     public void addSubResult(SampleResult subResult) {
-        addSubResult(subResult, true);
+        addSubResult(subResult, isRenameSampleLabel());
+    }
+
+    /**
+     * @return true if TestPlan is in functional mode or property subresults.disable_renaming
is true
+     * @see https://bz.apache.org/bugzilla/show_bug.cgi?id=63055
+     */
+    protected final boolean isRenameSampleLabel() {
+        return !(TestPlan.getFunctionalMode() || DISABLE_SUBRESULTS_RENAMING);
     }
+
     /**
      * Add a subresult and adjust the parent byte count and end-time.
      * 
@@ -652,7 +664,7 @@ public class SampleResult implements Ser
      *            the {@link SampleResult} to be added
      */
     public void addRawSubResult(SampleResult subResult){
-        storeSubResult(subResult, true);
+        storeSubResult(subResult, isRenameSampleLabel());
     }
     
     /**
@@ -676,7 +688,7 @@ public class SampleResult implements Ser
      *            the {@link SampleResult} to be added
      */
     public void storeSubResult(SampleResult subResult) {
-        storeSubResult(subResult, true);
+        storeSubResult(subResult, isRenameSampleLabel());
     }
     
     /**

Modified: jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java?rev=1852943&r1=1852942&r2=1852943&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java Mon Feb  4 20:19:53
2019
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.testelement.TestPlan;
 import org.apache.jmeter.util.Calculator;
 import org.apache.jmeter.util.LogRecordingDelegatingLogger;
 import org.apache.jorphan.test.JMeterSerialTest;
@@ -344,5 +345,31 @@ public class TestSampleResult implements
             Thread.sleep(ms);
             return System.currentTimeMillis() - start;
         }
+
+        @Test
+        public void testCompareSampleLabels() {
+            final boolean prevValue = TestPlan.getFunctionalMode();
+            TestPlan plan = new TestPlan();
+            plan.setFunctionalMode(true);
+            try {
+                SampleResult result = new SampleResult();
+                result.setStartTime(System.currentTimeMillis());
+                result.setSampleLabel("parent label");
+
+                SampleResult subResult = new SampleResult();
+                subResult.setStartTime(System.currentTimeMillis());
+                subResult.setSampleLabel("subResult label");
+
+                result.addSubResult(subResult);
+                assertEquals("subResult label", subResult.getSampleLabel());
+
+                plan.setFunctionalMode(false);
+                subResult.setSampleLabel("parent label");
+                result.addRawSubResult(subResult);
+                assertEquals("parent label-0", subResult.getSampleLabel());
+            } finally {
+                plan.setFunctionalMode(prevValue);
+            }
+        }
 }
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1852943&r1=1852942&r2=1852943&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Feb  4 20:19:53 2019
@@ -100,6 +100,7 @@ containing a fix to this issue, we decid
 <ul>
     <li><bug>62934</bug>Add compatibility for JDBC drivers that do not
support QueryTimeout </li>
     <li><bug>62935</bug>Pass custom <code>mail.*</code> properties
to Mail Reader Sampler. Implemented by Artem Fedorov (artem.fedorov at blazemeter.com) and
contributed by BlazeMeter.</li>
+    <li><bug>63055</bug>Don't rename SampleResult Label when test is running
in Functional mode or property <code>subresults.disable_renaming=true</code>.
Implemented by Artem Fedorov (artem.fedorov at blazemeter.com) and contributed by BlazeMeter.</li>
 </ul>
 
 <h3>Controllers</h3>

Modified: jmeter/trunk/xdocs/usermanual/properties_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/properties_reference.xml?rev=1852943&r1=1852942&r2=1852943&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/properties_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/properties_reference.xml Mon Feb  4 20:19:53 2019
@@ -732,6 +732,11 @@ JMETER-SERVER</source>
     Set this to a value less than zero to disable the background thread.<br/>
     Defaults to: <code>5000</code>
 </property>
+<property name="subresults.disable_renaming">
+    Since version 5.0 JMeter has a new SubResult Naming Policy which numbers subresults by
default<br/>
+    This property if set to <code>true</code> discards renaming policy. This
can be required if you're using JMeter for functional testing.<br/>
+    Defaults to: <code>false</code>
+</property>
 </properties>
 </section>
 <section name="&sect-num;.17 Upgrade" anchor="upgrade">



Mime
View raw message