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 HCL DevOps Test UI (Test UI) 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.
- Disable the Simplified Scripting feature on the Test UI 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.
- The test application and the required environments must be configured for functional testing.
Test UI 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.
- 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
- Click Record a Functional Test Script().
- In the Record
a Functional Test Script dialog, 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.
- 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.
- Click Next.
- Optional: In the Select Script Assets page, modify the test object map and test dataset if you do not want to use the default settings.
- Click Finish to start recording.
The Recording Monitor opens and the recording starts.
- In the Recording Monitor toolbar, click to start your test application.
- 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.
- 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.
- 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.
- Close your application, if you want closing the application to be part of the script.
- Click Stop recording () when you finish recording.A Java™ test script is generated and displayed in the Java editor.