jmeter icon indicating copy to clipboard operation
jmeter copied to clipboard

Add TestExecutionScope and ThreadGroupScope variables, deprecate TestElement implements TestStateListener

Open vlsi opened this issue 2 years ago • 0 comments

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<ThreadGroup, timerState>
  • 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

vlsi avatar Dec 19 '23 09:12 vlsi