Events
Featured
Tricentis Virtual Summit is back for 2022

This fully online and free-to-attend conference is key to deliver innovation with confidence.

Register now
Transformation
Featured
Your transformation toolkit

Advance your enterprise testing strategy with our transformation toolkit.

Learn more
Best solutions: Connecting to FTP via JavaScript in NeoLoad

Load testing

Best solutions: Connecting to FTP via JavaScript in 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 Tricentis NeoLoad JavaScript. Here is an example of how to use FTP within a JavaScript using the FTPClient packages. FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. 

We have provided the basics to send and receive a file, create and change directories, etc. 

See a full list of FTPClient commands

The best solution for you to consider 

Copy and paste these code snippets into a skeleton JavaScript in your user path. 

Note: It is always required to have the Initialization routine placed first to connect to your FTP server before performing the additional actions.  Also, note that it’s recommended to include myFTPClient.logout(); and myFTPClient.disconnect(); at the end of your script to close your session’s connection. 

Initialization (required to connect, fill in servername, username and password)

Create a new folder with MKDIR command 

Change directory command 

Note: Using PUT or GET methods may require switching your FTP connection into passive transfer mode. To do that add this one line command: 

Put FTP file transfer into passive mode 

Use of the GET method

Use of the PUT method

Command PWD (Print Working Directory) 

Command LIST

For more information, click here. 

Next steps: Review documentation or talk to us 

Check out all of the content included within NeoLoad documentation.