Many times you face the situation when you need the flexibility to generate data in JMeter, sometimes the data might be complex, as in the case when you want to generate phone numbers in specific format, or ID numbers in specific format. To use the power of Java along with the simplicity of JMeter, fortunately, JMeter has the wonderful feature of Beanshell where you can call Java libraries. In the below example i will demonstrate how you can do that. Download the jar from https://mvnrepository.com/artifact/com.github.javafaker/javafaker Add the jar in your JMeter lib folder. Download the YML library from https://mvnrepository.com/artifact/org.yaml/snakeyaml Add the jar in your JMeter lib folder. Restart JMeter Add a Beanshell Sampler. Write the follwoing code: //In the code below I am getting a random Phone Number import com.github.javafaker.Faker; Faker fakeData = new Faker(); String phoneNo = fakeData.phoneNumbe...
In this blog I addresses most of non ordinary challenges that most of the automation testers face on daily basis.