Reputation: 1706
I am using jmeter from command line to perform an automated suite of tests on some targets.
It looks like this :
for files in ./*.jmx; do
./jmeter \
-n -t ${file}/Test_perfs_qgis_SHORT.jmx \
-l ${TEST_DIR_PATH}/at_bench.log \
-e \
-o ${TEST_DIR_PATH}/report \
-J TEST_DIR_PATH="${TEST_DIR_PATH}" \
-J COMMON_PARAM="someValue" \
-J ANOTHER_COMMON_PARAM="anotherValue" \
-J SPECIFIC_PARAM="someValue Or emptyIfNotExpected"
fi
Most of the targets share the same GET template, or at least allow unexpected parameter (that will then just be ignored). But some target fail when they receive extra parameter.
Thus, I added a PreProcessor to remove the parameter when their value is not provided.
if((vars.get("SPECIFIC_PARAM") == null)||(vars.get("SPECIFIC_PARAM")=="")){
sampler.getArguments().removeArgument("MAP");
}
And this works well. But Since I have around 50000 call, this will be triggered... a few times!
Considering this is for testing purpose, I fear this may have impact on results (though this may also be quite the same for all request).
Anyway, I am trying to find a way to remove it at startup : once for all requests.
Anyone has a tip on how to do it?
Upvotes: 0
Views: 349
Reputation: 13960
Considering what you are removing (an argument of the sampler), it cannot be removed elsewhere/globally. Maybe you could instead have 2 templates: one with and one without that parameter, and select the template with If controller base don value of the variable:
If Controller with condition: "${SPECIFIC_PARAM}"==""
Sampler without MAP argument
If Controller with condition: "${SPECIFIC_PARAM}"!=""
Sampler with MAP argument
Upvotes: 1