Search code examples
groovyjmeterbeanshell

JMeter -Groovy or Beanshell script for editing values in a excel


I am having a JMeter test case to upload an .xls file with multiple tabs of data . The data should be unique for each iteration Each tab has 100 values as ASDFG0002 ASDFG0002 POIUY0002

The ‘0002’ needs to be replaced for each iteration in multiple tabs .

How can I achieve this using Groovy/beanshell script


Solution

  • Not knowing the exact structure of your Excel document it's not possible to come up with the exact code so I can only provide generic instruction:

    1. Download tika-app.jar and drop it into JMeter Classpath
    2. Restart JMeter to pick the .jar up
    3. Amend the content of the file using Apache POI API and save the file under the different name
    4. Configure HTTP Request sampler to use the new file

    Here are examples of reading/writing Excel documents from Java/Groovy: