Code assets
Scriptless Web lets you run JavaScript code while the test is running in the browser's context. This article explains how to create and use a code snippet. For more information, see the Inject code tutorial.
To create a code snippet:
- In the Assets view, in the left pane, click Code Assets.
- On the right, click Add Code.
- In the Create a code asset form, provide the following:
- The asset's name
- (Optional) A description of up to 100 characters
- Your JavaScript code
The form includes sample code to help you get started.
- Click CREATE.
To use a code asset in your test:
- On the canvas, in Advanced mode, add a new step and select System > Run code.
- In the Add Flow Element form, from the Code to run (JavaScript) list, select the code asset you created.
- If you want to validate the result, select the Check result check box.
- If you want to use the result as a context variable later:
- Select the Push value to context check box.
- Select a value from theTransformationlist. For more information, see context variables.
- Click ADD.
To edit a code snippet:
-
Hover over a code and click Edit
.
- In the Update a code asset form, provide the following:
- The asset's name
- (Optional) A description of up to 100 characters
- Your JavaScript code
The form includes sample code to help you get started.
- Click UPDATE.
To delete a code snippet:
-
Hover over a code and click Delete
.