开发者

Jmeter - generate xml

I have a J2EE application that needs some extensive integration testing. I am using Jmeter to generate HTTP POST requests. So far I manage to send them to the server correctly but the xml is static.

I am looking for a way to insert dynamic/random values into the XML and then send it to the server. Something like a PreProcessor but I am not sure how it is done.

开发者_如何学Go

Can anyone provide:

1. JMeter tutorials?

2. How to generate dynamic/random xml content to HTTP request

3. JMeter examples

Many thanks,

Gadi.


JMeter guidelines strongly recommend to use pre-generated data to have good perfomance and accuracy.

The task could be done via CSV Data Set Config component (Best Practices, section 16.5). The main idea is to generate a big test data set, save it to text file and then use as params in request template (line of CSV file per request). One can put whole request as one and only param if s/he wish.

Please be noted that JMeter 2.3.4 (latest version atm) has some restrictions:

  • it doesn't understand multiline values (though such ones supported by CSV standard itself), so escaping might be required;
  • it doesn't understand column names, so it is possible to associate variables by column position only (not by logical name unfortunately).

Thanks, Maksim


you can insert dynamic or random data into the XML using __Random and __char functions nested in the XML.

So that everytime an xml is posted, the values will be random.

basically, just define your xml structure and use the __random and __char functions nested in each other to randomly create any random text/numbers. Then use the __time function to generate date/time data.


Another approach to test web-application is use of automated recording tools like Badboy to record steps that you wanted to test with your web application. Then you can pass the same script to Jmeter for testing purpose.

You can also pass different values to parameters within script to test different scenarios. For eg.Your application is having 'Login page' with username/password field. Then you can record the script in case of 1)valid and 2) invalid login credentials.

Then during testing you can pass different values through CSV or by modifying some values directly in recorded script.

You can find more information about Badboy at http://www.badboy.com.au/


Worked for me by adding it in the xml directly like this on the tag you want to randomize:

numeric random ${__Random(0,10)} string random ${__RandomString(3,ABCDEFGHIJKLMNÑOPQRSTUVWXYZ)}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜