Bug 62323 - Add function "__ThreadGroupName" function to obtain ThreadGroup name
Summary: Add function "__ThreadGroupName" function to obtain ThreadGroup name
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 4.0
Hardware: All All
: P2 enhancement (vote)
Target Milestone: JMETER_5.0
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2018-04-24 07:00 UTC by orimarko
Modified: 2018-05-12 11:10 UTC (History)
2 users (show)



Attachments
Patch with new Thread Group Name function and tests (6.67 KB, patch)
2018-04-24 08:11 UTC, orimarko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description orimarko 2018-04-24 07:00:22 UTC
Need to add thread group name function when need to differentiate or display current thread group.

It will help especially when reusing same Test Fragment in different thread groups.

https://stackoverflow.com/questions/49963015/jmeter-test-fragment-use-case-to-generate-different-name-in-jmeter-result/49963095?noredirect=1#comment86942241_49963095
Comment 1 orimarko 2018-04-24 08:11:47 UTC
Created attachment 35889 [details]
Patch with new Thread Group Name function and tests

Thread Group Name function uses AbstractFunctionByKey

I suggest all/most functions will extends AbstractFunctionByKey instead of AbstractFunction to reduce code duplication of key/desc handling
Comment 2 Philippe Mouawad 2018-05-12 08:14:28 UTC
Author: pmouawad
Date: Sat May 12 08:12:59 2018
New Revision: 1831451

URL: http://svn.apache.org/viewvc?rev=1831451&view=rev
Log:
Bug 62323 - Add function "__ThreadGroupName" function to obtain ThreadGroup name
Mainly contributed by Orimarko
Bugzilla Id: 62323

Added:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/AbstractFunctionByKey.java   (with props)
    jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java   (with props)
Modified:
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/functions.xml
Comment 3 Philippe Mouawad 2018-05-12 08:15:34 UTC
Hello,
Thanks for contribution , I slightly modified code:
- to avoid protected static which would have side effects.
- to add functions.xml information



Please review and check.
Thanks
Comment 4 Philippe Mouawad 2018-05-12 08:17:02 UTC
Author: pmouawad
Date: Sat May 12 08:16:42 2018
New Revision: 1831453

URL: http://svn.apache.org/viewvc?rev=1831453&view=rev
Log:
Tab space police

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestSimpleFunctions.java
Comment 5 Philippe Mouawad 2018-05-12 11:10:26 UTC
Author: pmouawad
Date: Sat May 12 11:09:47 2018
New Revision: 1831464

URL: http://svn.apache.org/viewvc?rev=1831464&view=rev
Log:
Make function start with lower case

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/ThreadGroupName.java
    jmeter/trunk/xdocs/changes.xml
Comment 6 The ASF infrastructure team 2022-09-24 20:38:13 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4769