Replacing a JavaScript file in a test script

You can rename a JavaScript file in a project, delete it, or move it in the project, in all cases, the updates will apply in all test scripts in the project. When you rename a JavaScript file that is used in a Web UI test script from the Test Navigator, the system can automatically search for all references to the JavaScript file in the project and overwrite the custom JavaScript file with the updated one in all the test scripts where the JavaScript file is called. It is useful when you have multiple calls of the same JavaScript file in a single script.

Procedure

To replace a JavaScript file with a new one:
  1. In a project, right-click on a JavaScript file in the Test Navigator, and 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. Click Preview.Procedure f or replacing a JavaScript file.
  4. A wizard displays all references to the JavaScript files in the project. 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. Click OK. A message prompts you to accept or abort the changes.

Results

Once validated, the initial JavaScript file is replaced with the new JavaScript file in all the test scripts where it is called.
Feedback