Manually Insert Java Methods
You can use pre-defined Java packages within a Vuser script. The packages can be included in specific archive files or in the archive files contained in designated folders.
You can customize the function generation settings by modifying the recording options. For more information, see General > Script Recording Options.
To insert Java functions:
Click within your script at the desired point of insertion.
Click Java Function in the toolbar. The Insert Java Function dialog box opens. Here you can add functions to your Vuser script.
Packages, classes, methods, and other objects are represented by icons as follows:IconItemExamplePackagejava.utilClasspublic class Hashtable extends java.util.Dictionaryimplements java.lang.Cloneable, java.io.SerializableInterface Classpublic interface EnumerationMethodpublic synchronized java.util.Enumeration keys ()Static Methodpublic static synchronized java.util.TimeZone getTimeZoneConstructor Methodpublic void Hashtable ()
Under Locations, VuGen lists the paths and archives defined in the CLASSPATH environment variable
To add a path, click Select Folder and then locate and highlight the required folder.
To add an archive (jar or zip), click Select Library and then locate and highlight one or more archive files.
Repeat for each path or archive you want to add.
Select or clear the check boxes to the left of each item in the Locations list. If an item is selected, its members will be listed in the Packages list below.
Click Packages to close the Locations area and view the available packages.
Tip: Click the arrows to the left of each item in the navigator, to expand or collapse the trees.
Select an object and click Insert. VuGen inserts the object at the location of the cursor in the script. To paste all the methods of a class into your script, select the class and click Insert.
Repeat for all of the desired methods or classes, and then click Close.
Note: When you close the Insert Java Function dialog box, VuGen gives you the option to add the newly added locations to the Classpath list in the Java Environment runtime settings.
Modify the method parameter.
If the script generation setting DefaultValues is set to true, you can use the default values inserted by VuGen.
If DefaultValues is set to false, you must add parameters for all methods you insert into the script.
In addition, modify any return values. For example, if your script generated the following statement:
replace (String) with a string type variable.
Save the script and run it from VuGen.