jmeter
jmeter copied to clipboard
feat: allow expressions for TestElement.enabled property
Description
This is a proof-of-concept implementation for conditional TestElement.enabled.
The downside is that isEnabled() call would be added for every sampler, listener, pre-processor, pos-processor, and so on which might slow down the execution.
Motivation and Context
See https://github.com/apache/jmeter/issues/6006
How Has This Been Tested?
See EnabledWithVariablesTest
Screenshots (if appropriate):
WIP:
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="false">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="${__javaScript(false)}">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
Checklist:
- [ ] UI: select the location and the control style
- [x] UI: implement saving the plan to jmx
- [ ] UI: implement loading the plan from jmx
- [ ] Verify if TestBean-based components work as well
- [ ] Support
..RequestDefaults. The logic ofmerge...Elementprobably needs ignoring disabled elements - [ ] Decide if
interface JMeterGUIComponentneeds to support expressions. Currently there'sboolean getEnabled()andsetEnabled(boolean) - [ ] Add documentation
- [ ] Analyze if the following is still needed: https://github.com/apache/jmeter/blob/91ed1279438cbc2553121c8ea1afded0605b38e5/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterTreeModel.java#L169-L175