jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 02/02: Recurse into sampleResults for getSampleList
Date Tue, 10 Mar 2020 19:43:59 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 30a71a3112e436889d69ab9d2cb5403f4a3ab59c
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sun Mar 8 16:58:35 2020 +0100

    Recurse into sampleResults for getSampleList
    
    With this change we collect the sampleList of a SampleReult by recursing up to
    three levels into sub results of SampleResults instead of only one level deep.
    
    This helps in case of parallel downloads of embedded elements of a web page, which
    get stored as sub-sub-sampleresults. Before this change a regex Post Processor would
    not see those sub-sub-sampleresults.
    
    Bugzilla Id: 64196
---
 .../jmeter/testelement/AbstractScopedTestElement.java | 19 ++++++++++++++++++-
 xdocs/changes.xml                                     |  1 +
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/testelement/AbstractScopedTestElement.java
b/src/core/src/main/java/org/apache/jmeter/testelement/AbstractScopedTestElement.java
index ecacd7a..518d9fe 100644
--- a/src/core/src/main/java/org/apache/jmeter/testelement/AbstractScopedTestElement.java
+++ b/src/core/src/main/java/org/apache/jmeter/testelement/AbstractScopedTestElement.java
@@ -18,6 +18,7 @@
 package org.apache.jmeter.testelement;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
@@ -157,8 +158,24 @@ public abstract class AbstractScopedTestElement extends AbstractTestElement
{
             sampleList.add(result);
         }
         if (isScopeChildren(scope) || isScopeAll(scope)) {
-            Collections.addAll(sampleList, result.getSubResults());
+            recurseResults(sampleList, result);
         }
         return sampleList;
     }
+
+    private void recurseResults(List<SampleResult> resultList, SampleResult sampleResult)
{
+        Collections.addAll(resultList, sampleResult.getSubResults());
+        recurseResults(resultList, sampleResult.getSubResults(), 3);
+    }
+
+    private void recurseResults(List<SampleResult> resultList, SampleResult[] sampleResult,
int level) {
+        if (level < 0) {
+            return;
+        }
+        for (SampleResult child: sampleResult) {
+            Collections.addAll(resultList, child.getSubResults());
+            recurseResults(resultList, child.getSubResults(), level - 1);
+        }
+    }
+
 }
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 7d56b01..a35cdc4 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -181,6 +181,7 @@ to view the last release notes of version 5.2.1.
     <li><bug>64091</bug>Precise Throughput Timer might produce less samples
when low test duration is used</li>
     <li><bug>64142</bug>Presence of DebugPostProcessor in Test plan breaks
ActiveThread Over time in report due to missing information</li>
     <li><bug>64196</bug>Recurse into sub samplers more deeply when checking
assertions</li>
+    <li><bug>64196</bug>Recurse into sampleResults for <code>AbstractScopedTestElement#getSampleList</code></li>
 </ul>
 
 <h3>Functions</h3>


Mime
View raw message