1

I'm using Neoload 8.0.2 and I want to write a variable extracted from response in an external .txt file. For that I am using Neoload's JavaScript Action and I have written the following code snippet:

var file = java.io.File("C:\\filename.txt");
var writer = new java.io.FileWriter(file,true);
var var1 = context.variableManager.getValue("extVar");
writer.write(var1 + "\n");
writer.close();

I am not getting any errors in Neoload but file is not being created and if I create a file in the mentioned path myself the extvar (extracted variable) don't gets written on it. Is there something wrong with this script or do I need to install any . jar classes in Neoload? Or does java.io.file is pre-installed in Neoload?

Any guidance will he helpful.

usama ibrahim
  • 63
  • 1
  • 5

1 Answers1

0

This is not recommended during performance testing (for any tool) to have raw file IO to an output file accessed by multiple virtual users. This will create lock problems and performance issues on your load generators. Again, this is independent of tool.

The most common reason that people try to engage in this behavior is to pass data from one script to another. The recommended path is to leverage a queue service for this type of passing of data, where one script generates output that is needed as input for a different script. You have many paths here, but I would recommend considering any of the cloud based queue services that have HTTP interfaces and are super cheap for hundreds of thousands of messages. You also have the ability to leverage RabbitMQ as an internally installed piece of software. It also has available HTTP interfaces for direct inclusion in your test code.

James Pulley
  • 5,606
  • 1
  • 14
  • 14