Reusable Snippets in the Visual Editor

Overview

You can use Reusable Snippets to create building blocks that cover common user flows so that test creation and maintenance are significantly quicker. Rather than repeatedly writing the same steps across 5, 10, or 100 tests for common actions like entering a username and password to log in your application, just write them once in a Reusable Snippet. Once you've created this Reusable Snippet you can use this building block to speed up test writing and maintenance. When flows change you can just edit your Reusable Snippet once and those changes propagate to any tests (or other Reusable Snippets) that contain that Snippet.

Reusable Snippets are similar to tests because they cover specific user flows and can be edited via the Visual Editor, but they differ in a few key ways:

  • Reusable Snippets can’t be run (Tests should cover end to end flows, Reusable Snippets are building blocks of tests)
  • Reusable Snippets don't belong to Features, Saved Filters, Run Groups. They may span many Features and can't be run so these means of organization don't apply.
  • Reusable Snippets don't have owners, priorities, or states (e.g. disabled vs active)

Common Use Cases

Any test steps that appear commonly within your user flows are great candidates for Reusable Snippets. We often see teams cover:

  • Login
  • Setting up a new account
  • Adding items to your cart
  • Checking out

Creating a Reusable Snippet

You can create Reusable Snippets from existing test cases by extracting existing steps so don't worry if you haven't thought through your entire Snippet hierarchy from the start.

To extract these steps:

  1. Select the steps you wish to extract
  2. Select Edit > Create Reusable Snippet from selection
12271227

You can also create Reusable Snippets from scratch:

  1. Navigate to the Test Page (or the Reusable Snippets, Features, or Run Group tabs)
  2. Select the Create button
  3. Select Reusable Snippet
  4. Use the Visual Editor to add steps like you would for a test

Note that a Reusable Snippet’s starting URL is used to preload the platform for testing. When a Reusable Snippet is added to a test, the Snippet's starting URL is ignored, and the parent test's URL is used instead. If a Reusable Snippet requires a specific URL, add a Navigate action and specify the URL.

11331133

Adding Reusable Snippets to Tests or other Reusable Snippets

To add a Reusable Snippet to a Test or Reusable Snippet:

  1. Open or create a test
  2. Select the + icon in the actions panel in the Visual Editor
  3. Select the Snippet option
  4. Either search or scroll to find the Reusable Snippet you plan to add (n.b. that only Visual Editor Snippets will appear here)
486486

Editing Reusable Snippets

You can edit Reusable Snippets in one of two ways–

First, you can directly edit them via the Visual Editor by selecting them from the Reusable Snippets Tab just like you'd edit a test.

Or you can edit them directly in a parent test. This is much easier for non-login steps that occur later in a test because you can preview steps prior to the step that needs editing so you can speed up getting to the appropriate steps that need editing. To do this:

  1. Click the edit icon (pencil and paper) next to the embedded test. You'll just be able to edit the steps of that Snippet.
  2. Make your changes.
  3. Click the Save Changes button.
  4. Click the “I’m aware, save my changes” button to confirm you want to update all tests that include that Snippet.
  5. Continue editing the test.

Reusable Snippet Tab and Organization

Reusable Snippets appear under a tab on the All Tests Page. Here you can:

  • Sort your Snippets Via the Column Headers
  • Search through all your Snippets
  • Use Bulk Actions to Delete or add Tags to Reusable Snippets

See Where Reusable Snippets Are Used

You can see where your Reusable Snippets are included in two places–

  1. In the visual editor you can see how many tests include that Snippet under the test title. To see which specific Tests and Reusable Snippets include that Snippet, go to* Settings > View.
13071307
  1. Under the Reusable Snippets Tab you'll see the Included Incolumn that summarizes how many Tests and other Reusable Snippets that Snippet is included in. Hovering over it shows you which specific Tests and Snippets those are.
28802880

Did this page help you?