Renaming the JavaScript file in a test script

You can rename the JavaScript file with a new one in the project. This change reflects in all the test scripts in the project that use the same JavaScript file.

About this task

You can also move or delete the JavaScript file in the project. When you make changes to the JavaScript file that is used in a Web UI test script from the Test Navigator, the system automatically searches for all references to the JavaScript file in the project and overwrite the file with the updated one in all the test scripts where the JavaScript file is called. This feature is useful when you have multiple calls of the same JavaScript file in a single script.

Procedure

  1. Right-click the JavaScript file in a project in the Test Navigator, and then select Rename.
  2. Enter a new name in the text field of the dialog that opens.
  3. Select Update test Assets that reference the renamed resource.
  4. Click Preview.
    A wizard is displayed with all the references to the JavaScript file in the project.
  5. Unselect the references that should not be updated and unselect Custom JavaScript change participant if you don't want any changes in the associated files.
    Procedure f or replacing a JavaScript file.
  6. Click OK in the Changes to be performed page.
  7. Click OK in the Rename Element dialog.

Results

You have renamed the initial JavaScript file with the new JavaScript file in all the test scripts where it is called.