JavaScript libraries

JavaScript libraries allow creating functions that can be used in all User Path scripts. Libraries not only allow code sharing between several scripts, they also help reduce memory usage on the Load Generators, since the code stored in the libraries is shared by the users, whereas code contained in scripts is loaded into memory for each Virtual User. It is therefore recommended, wherever possible, to use functions whose code is stored in a library.


Create a JavaScript library

A JavaScript library is identified by its name and library file. You may use an existing file or create a new, empty file. Each library may contain one or several JavaScript functions.

  1. Select the Edit > JS Libraries menu item.
  2. Click on New library.
  3. In the following wizard, enter the name of the library.
  4. Choose either to create a new library or use an existing file, whichever is appropriate.
  5. Confirm the choice to exit the wizard.
  6. Select the created library in the library list.
Edit a JavaScript library

Access the libraries through the Edit > JS Libraries menu item.

If the file has been edited using an external editor, it must be reloaded into the interface using the Reload button.

Use the Compile button to compile the JavaScript libraries prior to execution. Compiling will check the script syntax (missing parentheses...) but not its validity (call method names ...).