Code snippets in EveryStep Recorder allow you to reuse common sequences of actions—such as user interactions or validations—across multiple scripts. By creating and managing snippets, you can streamline the scripting process and maintain consistency throughout your monitoring and load testing configurations.

Creating a New Snippet

Creating a Snippet While Recording

A new snippet can be created in EveryStep Recorder in the Recording mode as a part of a new EveryStep script.

A snippet must be used in at least one monitoring device in order to be saved to the system library. To ensure the snippet is saved to the library, make sure to save the device that contains the script referencing the original snippet.

To create a new snippet:

  1. In Everystep Recorder, start recording a new script.
  2. In Recording mode, click Snippet on the left side menu and select Begin.
  3. In the Begin Snippet window, provide a unique name you want to use for the snippet.
  4. Continue recording the actions that you want to include in the snippet.
  5. To stop recording the snippet, on the left side menu, select Snippet > End.
  6. To save the snippet to the EveryStep library, playback and save the script and the associated device. Once the device is saved, the custom snippet will be available for reuse in other scripts.

Image and RIA Validation are not supported within snippets.

Recording a New Snippet for a Pre-recorded Script

To record and add a snippet to a pre-recorded script:

  1. In ES Recorder, in the Script Code section, right-click a line (step) after which you want to add the snippet and from the editor context menu, select Snippet > Begin.
  2. In the Begin Snippet window, provide a unique name for the snippet.
  3. Click Record and record the actions you want to save as the snippet.
  4. To stop recording the snippet, on the left side menu, select Snippet > End.
  5. Stop recoding and save the script and the device to add the snippet to the Everystep library.

Adding an Existing Snippet to a Script

During Recording

To reuse an existing snippet while recording a script:

  1. In the recording mode, click Snippet on the left side menu and select Insert Existing.
  2. Select the snippet from the list of available snippets. You can preview the code in the snippet preview window before adding it.
  3. Allow the system to replay the script with the added snippet to validate the script. Once the script has been replayed, the snippet will be added to the script code.

In a Pre-recorded Script

To add a snippet to a pre-recorded script, in ES Recorder, right-click a line (step) after which you want to add the snippet in the Script Code section and from the editor context menu, select Snippet > Insert Existing.

Editing a Snippet

A custom snippet is available for editing only as a part of the script in the Everystep Recorder window.

To edit a snippet:

  1. Open the script containing the snippet in EveryStep Recorder.
  2. Make changes to the snippet code using the same methods described in Editing a Script in EveryStep Scripting Tool.

When saving changes to a snippet, the system validates all associated scripts. If any script fails validation, the changes cannot be saved.

Applying Changes to a Specific Device Only

To apply snippet changes to a single device without affecting the other scripts using the original snippet:

  1. In the Edit Code section, click the BeginSnippet method for the snippet you want to edit.
  2. Provide a new, unique name for the snippet in the snippet settings.
  3. Close the snippet settings panel.
  4. Save the device to create a new instance of the snippet in the snippet library.

Deleting a Snippet from the EveryStep Library

Remove the snippet from all devices that utilize it.

If a snippet is associated with only one device, it will be automatically deleted upon the device’s removal.

 

For more detailed guidance on using EveryStep Recorder and managing code snippets, please refer to the EveryStep Scripting Tool documentation.