Bug 59963

Summary: New Function __RandomFromMultipleVars: Ability to compute a random value from values of 1 or more variables
Product: JMeter Reporter: UbikLoadPack support <support>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: enhancement CC: p.mouawad
Priority: P2    
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch that implements function

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