--- src/core/org/apache/jmeter/resources/messages.properties (revision 1755399)
+++ src/core/org/apache/jmeter/resources/messages.properties (working copy)
@@ -784,6 +784,8 @@
ramp_up=Ramp-Up Period (in seconds)\:
random_control_title=Random Controller
random_order_control_title=Random Order Controller
+random_multi_result_source_variable=Source Variable(s) (use | as separator)
+random_multi_result_target_variable=Target Variable
random_string_chars_to_use=Chars to use for random string generation
random_string_length=Random string length
realm=Realm
--- src/core/org/apache/jmeter/resources/messages_fr.properties (revision 1755399)
+++ src/core/org/apache/jmeter/resources/messages_fr.properties (working copy)
@@ -769,6 +769,8 @@
ramp_up=Dur\u00E9e de mont\u00E9e en charge (en secondes) \:
random_control_title=Contr\u00F4leur Al\u00E9atoire
random_order_control_title=Contr\u00F4leur d'Ordre al\u00E9atoire
+random_multi_result_source_variable=Variable(s) source (separateur |)
+random_multi_result_target_variable=Variable cible
random_string_chars_to_use=Caract\u00E8res \u00E0 utiliser pour la g\u00E9n\u00E9ration de la cha\u00EEne al\u00E9atoire
random_string_length=Longueur de cha\u00EEne al\u00E9atoire
realm=Univers (realm)
--- src/functions/org/apache/jmeter/functions/RandomFromMultipleVars.java (revision 0)
+++ src/functions/org/apache/jmeter/functions/RandomFromMultipleVars.java (revision 0)
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.functions;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.jmeter.engine.util.CompoundVariable;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.threads.JMeterVariables;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * Provides a RandomFromMultiResult function which returns a random element from a multi valued extracted variable.
+ * Those kind of variable are extracted by:
+ * - Regular Expression extractor
+ * - JSON PATH extractor
+ * - CSS/JQuery extractor
+ * - XPath Extractor
+ *
+ * @since 3.1
+ */
+public class RandomFromMultipleVars extends AbstractFunction {
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
+ private static final ListCalculation intSum add int numbers 1.8.1 Calculation longSum add long numbers 2.3.2
+ Calculation Random generate a random number 1.9 Calculation RandomFromMultipleVars extracts an element from the values of a set of variables separated by |
3.1 Calculation RandomString generate a random string 2.6 Calculation UUID generate a random type 4 UUID 2.9
@@ -648,6 +649,34 @@
Scripting BeanShell run a BeanShell script 1.X
The RandomFromMultipleVars function returns a random value based on the variable values provided by Source Variables
.
-1
for Match Numbers
.
+This leads to creation of match number variable called varName_matchNr
and for each value to the creation of variable varName_n
where n = 1, 2, 3 etc.
+
+|
that contain the values that will be used as input for random computationExamples:
+ will return a random string based on content of variable val taking into account wether they are multi-value or not
+ will return a random string based on content of variables val1 and val2 taking into account wether they are multi-value or not
+ will return a random string based on content of variables val1 and val2 taking into account wether they are multi-value or not and store the result in MYVAR
+
The UUID function returns a pseudo random type 4 Universally Unique IDentifier (UUID).