Bug 59963 - New Function __RandomFromMultipleVars: Ability to compute a random value from values of 1 or more variables
Summary: New Function __RandomFromMultipleVars: Ability to compute a random value from...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.0
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-09 18:23 UTC by UbikLoadPack support
Modified: 2016-08-10 15:20 UTC (History)
1 user (show)



Attachments
Patch that implements function (10.67 KB, patch)
2016-08-09 18:23 UTC, UbikLoadPack support
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description UbikLoadPack support 2016-08-09 18:23:46 UTC
Created attachment 34119 [details]
Patch that implements function

In our campaigns and during our exchanges with our customer we frequently face the need to extract a random value from values of variables extracted by the core JMeter extractors Regex, CSS/JQuery, JSON Path, XPath Extractor.
Knowing that those extractors can create 1 to N+1 variables depending on number of matches (one suffixed with _matchNr, and the ones suffixed with _n where n is between 1 and n when you select Match to be equal to 1).


When we need to use one value from those ones, we always have to code this in a custom JSR223 code using Groovy for example.
This code is not easy for beginners and error prone, and for other users it makes code less readable.

To overcome this limitation, we have coded a new function that does that.

Find the patch attached that we donate to Apache JMeter knowing we have signed a CCLA.
Comment 1 Philippe Mouawad 2016-08-09 18:32:26 UTC
Date: Tue Aug  9 18:31:12 2016
New Revision: 1755638

URL: http://svn.apache.org/viewvc?rev=1755638&view=rev
Log:
Bug 59963 - New Function __RandomFromMultipleVars: Ability to compute a random value from values of 1 or more variables
Bugzilla Id: 59963

Added:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/RandomFromMultipleVars.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/functions.xml
Comment 2 Philippe Mouawad 2016-08-09 18:32:42 UTC
Thanks for contribution
Comment 3 UbikLoadPack support 2016-08-10 15:20:57 UTC
Author: pmouawad
Date: Wed Aug 10 15:13:36 2016
New Revision: 1755766

URL: http://svn.apache.org/viewvc?rev=1755766&view=rev
Log:
Bug 59963 - New Function __RandomFromMultipleVars: Ability to compute a random value from values of 1 or more variables
Handle matchNr == 0 (JSON Path Extractor)
reuse value
Bugzilla Id: 59963

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/RandomFromMultipleVars.java