How can we remove a request parameter once (at startup) from a JMeter Test Plan?

Marvin

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?

Kiril S.

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Can we run Jmeter test from different geo location simultaneously?

How to design this test plan in JMeter

How can we remove a ':' characters from a string?

How to remove a parameter from HttpServletRequest request?

How to start and pause jmeter test plan run

JMeter don't execute all request of my test plan

How to call property we just defined from the first request to use in the next request jmeter?

Structuring JMeter Test Plan

Jmeter: How to map specific variable values from CSV file to specific thread-groups in a test plan

How can I remove a forkbomb from the Startup folder?

How I can get attribute from request Jmeter

How we can enable socket testing Jmeter using script and run the test case?

how can we get the value of of VARRAY from IN Parameter in procedure

How can we check if response for the request came from Service Worker

How can we setup Startup tasks

How can we remove deep link data from intent

How can we remove on server from Directory in OpenLdap?

How can we remove "Authorization" Header from a 'HttpServletRequest'

How can we remove one solid color from an Image?

How can we remove adSense ads from post content

How can we remove duplicate children value from array of object

How can we remove comma only from new lines in js

how can we remove the draggable property from modal window in wicket

how can we remove the rows from xts based on the seconds criteria

How can we extract specific test from the text in python

Getting an error from the application when recording a Jmeter test plan

Plan to execute choice of test cases from jmeter script using keywords

Can we pass form data to angular http request all at once

Can we add validation to the request body based on the request Parameter