Skip to content

Move file to another directory in Jmeter

I’m trying to do performance test in Jmeter so before run my test i have to get fresh data, basically I need to move my used csv file after completed test execution.

Answer

  1. Add setUp Thread Group to your Test Plan

  2. Add JSR223 Sampler to the setUp Thread Group

  3. Put the following code into “Script” area:

    org.apache.commons.io.FileUtils.moveFile(new File('/current/path/to/csv.file'),new File('/new/path/to/csv.file'))
    
  4. That’s it, the setUp Thread Group is executed before “main” Thread Groups and the code will move the file