jmeter icon indicating copy to clipboard operation
jmeter copied to clipboard

Add variable support for Include Controller

Open polarnik opened this issue 3 years ago • 6 comments

  • Add variable support for includePath
  • Add tests for getIncludePathAsFunction()

Description

The IncludePath field has added support for variables.

Motivation and Context

I want to use files in Include Controller whose names are set in variables.

For Example 1. I want to run the test with loading static resources and without loading static resources. Static resources - 200 links. If I use If Controller, then an optional block with static resources will be in the script, it will take up memory. If I use Include Controller with variable support, then optional block with 200 links may be change for block with 0 links. A block with 0 links will not take up memory.

For Example 2. I work in a large team. We decided to change the Access Token update block in all scenarios. From the test_fragment_refresh_Access Token_v1.jms option to test_fragment_refresh_Access Token_v2.jmx. 10 scripts.

Instead of 10 changes in the scripts. The function ${__property(text_fragment_refresh_access Token)} or ${__P(text_fragment_refresh_access Token)} will be used. And there will be one change in user.property.

How Has This Been Tested?

I write some tests. And test via gradle runGui. For troubleshooting: add debug loggings.

Screenshots (if appropriate):

Fail load: image

Ok load, debug logging: image

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] I have updated the documentation accordingly.

polarnik avatar Dec 09 '21 23:12 polarnik

Codecov Report

Merging #679 (be21f47) into master (edc7727) will increase coverage by 0.00%. The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #679   +/-   ##
=========================================
  Coverage     55.57%   55.58%           
- Complexity    10333    10335    +2     
=========================================
  Files          1059     1059           
  Lines         65055    65065   +10     
  Branches       7403     7400    -3     
=========================================
+ Hits          36156    36167   +11     
  Misses        26349    26349           
+ Partials       2550     2549    -1     
Impacted Files Coverage Δ
...a/org/apache/jmeter/control/IncludeController.java 59.78% <80.00%> (+3.37%) :arrow_up:
...n/java/org/apache/jmeter/reporters/Summariser.java 90.07% <0.00%> (-0.77%) :arrow_down:
...he/jmeter/threads/openmodel/gui/TargetRateChart.kt 6.25% <0.00%> (+0.36%) :arrow_up:
...jmeter/protocol/http/control/HttpMirrorServer.java 42.42% <0.00%> (+1.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update edc7727...be21f47. Read the comment docs.

codecov-commenter avatar Dec 25 '21 20:12 codecov-commenter

Hi,

I see this PR is still open. It is from 2021. Is there any reason this didn't make it into master? I badly need this feature. Thx

ClemRz avatar Jun 06 '23 09:06 ClemRz

@ClemRz , could you please clarify your use case in more detail?

vlsi avatar Jun 06 '23 09:06 vlsi

@vlsi We have a pipeline that runs ~50 jmx files simultaneously and we have to use a bash script to replace the value of the include controller using sed in a main.jmx file for each one of those ~50 builds. It's not ideal nor future-proofed.

ClemRz avatar Jun 14 '23 18:06 ClemRz

Have these changes been integrated into version 5.6.3?

I'm also interested in the possibility of testing 2 different authentication modes. Indeed, JMeter scripts must be used in 2 environments with different authentication modes (migration in progress). At present, I have to duplicate all the scripts to be able to run tests on these 2 environments. With this possibility, we could declare the JMeter authentication module to be used in the script launch parameters.

jlerbsc avatar Apr 24 '24 08:04 jlerbsc