How to Write Files in Groovy/Beanshell in BlazeMeter

When running your Performance Tests in BlazeMeter, using JSR223 Pre/Post processors is a common practice to extract desired data from a response to a file. This applies to .txt and .csv files. When writing a file using this element, include the following path to ensure the file gets written to the correct folder:

/tmp/artifacts/<YourFilename.txt>

For example, instead of Results.txt, write /tmp/artifacts/Results.txt.

You can also exclude the path and only specify <YourFilename.txt> in your script and the file will automatically be created in the /tmp/artifacts folder.

As a result, you'll find the output file in the "artifacts.zip" file of your Test results.