I wanted to test out our web services by generating random email address for new account creation. I found this really helpful article that demonstrated JMeter’s innate capabilities to generate random numbers and strings. I had to struggle a bit because I was uploading JSON files’s to post and used the random number sequence within. But learned that JMeter would generate random numbers only with the “Post Body” field under HTTP Sampler Request > HTTP Request > Post Body
Here’s a sample JSON that I used to generate a random email address by using the Random function:
{ "TransactionID": "1E90F287-AB23-923A-2E8C-28ED01A7B02D", "RequestorTimestamp": "2013-03-01T11:22:18.01Z", "UserName": "Varun Verma", "CompanyName": "My Own Inc.", "EmailAddress": "varun.verma${__Random(1, 10000)}@myinc.com", "TotalUsers": "4", "StorageSize": "50", "ExpirationDays": 20 }
More information on functions can be found here: http://jmeter.apache.org/usermanual/functions.html
General information: http://jmeter.apache.org/usermanual/
Advertisements
I think you should add one http sampler in the beginning of test tree which will clear all emails which match varun.verma\d+@myinc.com regexp pattern and run this only once. Also would be useful article about JMeter functions as in official documentation there is less information about usage.
Thanks for the article, saved me a few hours of tinkering!
Cheers.
Very nice article, saved me a lot of time.