Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error generating variable with 44 characters in Jmeter

hello!

I have the following problem in Jmeter:

I want to add a code to my BeanShell Tester that generates a 44-character barcode. But so far, without success.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

So I went to plan "B":
I added a Random Variable with 44 characters, but it doesn’t get created. It does not display any errors.

Could someone help me and tell me what I can do to make it work?

Below are the variables:

Output format: 0000000000000000000000000000000000000000
Minimum value: 1000000000000000000000000000000000000000
Maximum value: 9999999999999999999999999999999999999999

Print below:
enter image description here

As for the code, I didn’t share it here, but if anyone knows and has a code that generates barcodes, I’d appreciate it!

Anyway, that’s it folks!

Thank you very much in advance!

>Solution :

If you’re doing Beanshell scripting (however since JMeter 3.1 you should be using Groovy) the better option would be doing something like:

vars.put("CodeBarra", org.apache.commons.lang3.RandomStringUtils.randomNumeric(44));

Alternatively you can use it in __groovy() function:

${__groovy(org.apache.commons.lang3.RandomStringUtils.randomNumeric(44),CodeBarra)}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading