JMeter, send form data ALL

I am trying to perform a website performance check using JMeter. However, the step I'm trying to verify contains over 200 elements in the form. I obviously want all the elements to be the same as the form displayed to the user (except the one I intend to change). I know that this is possible with regular expression extracts (see JMeter Questions - MVC: a posting model containing dymanic data ), however this will need to be manually configured for EVERY element in a form that is extensive!

Is there a way to get JMeter to submit all form elements without having to set each of them separately? or any plugin for this?

Any help would be greatly appreciated.

+8
performance performance-testing jmeter jmeter-plugins
source share
3 answers

After defining Regular Expression Extractor,

step1) Create a "Debug PostProcessor" with all values ​​= true

  • Properties Jmeter = true
  • Jmeter Variable = true
  • Properties Sampler = true
  • System Properties = true

When you check this mail processor, you will find all of your Post Parameters parameter values ​​in the list. try to find those that are suitable for sending along with the request "Post", and "Use API" to set paramName and paramVal, as shown below.

I used firebug to find out all the necessary message parameters. To learn how to use it, follow this link http://community.blazemeter.com/knowledgebase/articles/80479-how-to-use-jmeter-for-login-authentication

step2) create a "Beanshell pre processor" using this script. Where "hiddenList" is the reference name of your Regular Expression Instance.

log.info("====================="); count = Integer.valueOf (vars.getObject("hiddenList_matchNr") ) ; log.info("Number of hidden fields in previous sampler: " + count); for (i=1; i <= count; i++) { paramName = vars.getObject("hiddenList_"+ i + "_g1"); paramVal = vars.getObject("hiddenList_"+ i + "_g2"); log.info("Adding request parameter: " + paramName + " = " + paramVal); sampler.addArgument(paramName, paramVal); } log.info("====================="); 

Hope this helps.

+2
source share
Good question. After a long search, I find it strange that Jmeter does not support this more elegantly and requires a pretty workaround to just send back form data received on GET's preliminary request.

I found that ShGiji answered a little harder, and he had to dig around to adjust the extent of the regex, etc. Below are the steps I have taken.

  • Adjust the regex extent to get parameters from a response to a GET request

    To force Jmeter to create a list from the extent of the regular expression, the match number must be set to -1 (as described here ). Note that you also need to write the name and value of the parameter, so you should get something like this ...

Regular Expression Extractor example

  1. Optionally add a debug handler . If you do this, you must confirm that there are variables prefixed with the reference name of your choice (in the above example, you should expect fieldList_matchNr , fieldList_1_g1 , fieldList_1_g2 , etc.)

  2. Add a Beanshell post handler to add parameters to subsequent POST request form data

    The following script runs on Jmeter 2.11 (the latest version at the time of writing). Note the use of Integer.parseInt , not Integer.valueOf .

Beanshell mail processor:

 log.info("====================="); count = Integer.parseInt(vars.getObject("fieldList_matchNr")); log.info("Number of order details fields: " + count); for (i=1; i <= count; i++) { paramName = vars.getObject("fieldList_" + i + "_g1"); paramVal = vars.getObject("fieldList_" + i + "_g2"); log.info("Adding request parameter: " + paramName + " = " + paramVal); sampler.addArgument(paramName, paramVal); } log.info("====================="); 
+2
source share

An alternative approach would be to use the JMeter proxy functionality.

You can use JMeter (apart from it the ability to automate sending an HTTP request) to record your actions in the browser. Then you can visit the site and submit the form. Jmeter will record the HTTP request sampler, and all form elements will be extracted and filled with the values ​​you submitted. If you need different values ​​in your JMeter test, then what was sent in your browser, you can edit them to the correct values. Once you are done, you can save this as a test plan and then run it.

This will really work if you want to edit a small number of elements. If you want each element to represent a different value than what was sent in your browser, then you would better describe the above approach.

http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf

+1
source share

All Articles