apache / apache/jmeter

Introduce global Variables shared accross threads

Open
#4,548 1 comment 0 reactions 0 assignees View on GitHub
enhancement os: All P2
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

@pmouawad ([Bug 61674](https://bz.apache.org/bugzilla//show_bug.cgi?id=61674&redirect=false)):
There is frequently the need in Load Testing for sharing something accross threads which might have been initialized in a setup Thread Group or by some Thread.

Currently JMeter has 2 ways to do it:

- Properties but they are limited to String
- Through Beanshell (which is deprecated) through bsh.shared

A recent illustration of this is the Coverage Tests created for JMS, TCP and FTP.
To do it we had to use Beanshell.

So after discussion:
- http://mail-archives.apache.org/mod_mbox/jmeter-dev/201710.mbox/%3CCAH9fUpY3jEb%3D_Oa-fuf-RFuSUz2Nop5ix7%2BnPzy-yVc7C47_JA%40mail.gmail.com%3E

This would be introduced this way:

- any variable starting with "global:" is global
- JMeterVariables class modification, which would delegate all variables with "global:" prefix into global thread-safe map.
- The Map would be ConcurrentMap
- It would be initialized/cleared in StandardJMeterEngine#run or JMeterContextService.startTest();

See dev discussion:

OS: All

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.