Add TestExecutionScope and ThreadGroupScope variables, deprecate TestElement implements TestStateListener
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
### Use case
In many cases, test elements need "per-thread-group-scope" variable or "per-test-execution-scope" variable.
For instance:
* Timers use `static final Map`
* Summarizers might need their state as well
* DB connection pool might need to pool connections
The current approach of `element implements TestStateListener` causes issues like https://github.com/apache/jmeter/issues/6174, https://github.com/apache/jmeter/issues/6165
### Possible solution
We might need something like https://docs.gradle.org/current/userguide/build_services.html or https://github.com/google/guice/wiki/Scopes so the plugin authors can explicitly declare "per-test-execution state objects", so they do not need to implement `TestStateListener` in the test elements.
It might be worth deprecatign `TestElement implements TestStateListener` at least to discourage that usage pattern.
### Possible workarounds
_No response_
### JMeter Version
5.6.2
### Java Version
_No response_
### OS Version
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.