Recording a Java test script

Java™ scripts are generated when you work with the simplified scripts. You can switch to Java scripting using the Insert Java snippet and Insert Java module features in the simplified script editor.

Before you begin

Advanced users can opt to work solely with Java scripting. Use the recording feature of IBM® Rational Functional Tester to record actions on the test applications. The actions on the test applications are generated in the form of a Java test script when you stop recording.

Prerequisites:
  • Disable the Simplified Scripting feature on the Rational Functional Tester Preferences page. Alternatively, if you want to work with Java scripting only for the current script you will record, select Java Scripting from the Select Mode list in the Record a Functional Test Script dialog box.
  • The test application and the required environments must be configured for functional testing.
    From Rational® Functional Tester version 8.2.2 onwards, Rational Functional Tester automatically enables the environments for functional testing. As a result, you can directly record functional test scripts without enabling components manually. The automatic enablement takes place under certain conditions and has limitations. For more information about the conditions and limitations, see Automatically enabled environment for functional testing.
    Note: Enabling 64 bit JRE on 64 bit Linux causes the error "Wrong ELF class: ELFCLASS32' for libftsys.so.. Currently, Rational Functional Tester does not support 64 bit JRE on Linux.
  • A functional test project has been created.

About this task

All functional testing scripts use a default helper superclass. You can create your own helper superclass if you want to add additional methods or override the methods in RationalTestScript. For more information, see Changing the Default Script Helper Superclass.

Procedure

  1. Click Record a Functional Test Script(Record a Functional Test Script button).
  2. In the Record a Functional Test Script dialog box, select the project for the script to be a part of, and then type a name for the script.
    Note:
    • Script names cannot contain spaces or the following characters: $ \ / : & * ? " < > | # % -
    • The script name is appended to the project path. The project path and script name together should not exceed 230 characters.
  3. Optional: Select Add the script to Source Control to place the script to be under source control. The script is added to ClearCase® but remains checked out so that you can modify it.
  4. Make sure that Java Scripting is selected in the Select Mode list. You can make Java scripting as the default script mode by selecting the Default check box.
  5. Click Next.
  6. Optional: In the Select Script Assets page, modify the test object map and test datapool if you do not want to use the default settings.
  7. Click Finish to start recording. The Recording Monitor opens and the recording starts.
  8. In the Recording Monitor toolbar, click Start Application to start your test application.
  9. Perform test actions in the application.
    Note: To record the action of moving the mouse over a link that has a tooltip, move the mouse over the link so that the tooltip is displayed, and press Shift. This notifies the recorder to capture the action in the script.
  10. Optional: You can record verification points or data-drive your test script using the tools available in the Recording Monitor toolbar while recording the script.
  11. Optional: To insert statements to call another script, specify log information, timer or comments during recording, use the Insert Script Support Commands feature available in the Recording Monitor toolbar.
  12. Close your application, if you want closing the application to be part of the script.
  13. Click Stop recording (Stop recording button) when you finish recording. A Java test script is generated and displayed in the Java editor.

Feedback