Insert a Java method

You can insert a Java method to perform additional operations that are not supported by the simplified scripts. The Java method is added at the end of the Java script. You must insert a Java code snippet and call the Java method.


Before you begin

Prerequisite: Knowledge of Java programming

To insert a Java method:


Procedure

  1. Select the test line in the simplified script editor. Right-click and select Insert Java Method (). The test line JavaModule is inserted after the selected test line.

  2. Click File > Save to save the simplified script.

  3. Click Java editor that is displayed next to the Script editor. The Java method is displayed as a comment with the start and end points for inserting the Java code in the Java editor.

  4. Type the Java code within the comment section.

  5. Click File > Save to save the Java script. During script playback, the inserted Java code runs.

    Notes:

    • You must call the Java method from a Java code snippet. The Java method runs when the Java code snippet runs.

    • You can also call the Java method from a different script within the functional test project.

    • Do not edit the Java code outside the start and end points that are inserted when you use the Insert Java Method feature in the simplified script editor. All the changes to the Java script are lost if you later edit the simplified script.