Answered question

How could I connect to an FTP server using a javascript?

For my load testing, I have a need for my virtual users to connect to a FTP server and download some files. I did not see any FTP actions in Neoload. Is it something that can be done with Neoload?

During your load test, you may want your virtual user to connect to an FTP server to upload or download some files. This can be done through a Neoload javascript.

Here is an example of how to use FTP within a javascript using the FTPClient packages. All the available methods can be found here:Apache


// Initialisation

myFTPClient =new; myFTPClient.connect("servername"); myFTPClient.login("username","password"); logger.debug(myFTPClient.getReplyCode()+" "+myFTPClient.getReplyString());


//Command PWD


myFTPClient.printWorkingDirectory(); logger.debug(myFTPClient.getReplyCode()+" "+myFTPClient.getReplyString());


//Create a new folder with MKDIR command


myFTPClient.makeDirectory("FTPNeoload"); logger.debug(myFTPClient.getReplyCode()+" "+myFTPClient.getReplyString());

//Command LIST


engine =myFTPClient.initiateListParsing("/");

while (engine.hasNext())


file = engine.getNext(5);




//Use of the GET method


var writer = new"c:\\Temp\\",true);



logger.debug(myFTPClient.getReplyCode()+" "+myFTPClient.getReplyString());


//Use of the PUT method


var reader = new"c:\\Temp\\myfile.xps"); myFTPClient.storeFile("myfile.xps",reader);


logger.debug(myFTPClient.getReplyCode()+" "+myFTPClient.getReplyString());




For more information, see "NeoLoad Javascript API" in Neoload documentation.

Did you find this useful ?

No (1)

Yes (11)


92% of users found this answer useful