Reusable Snippets in the Plain-Text 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 or Plain Text 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 the pair of scissors > Extract Steps
  3. Confirm you intend to create a reusable snippet

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 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 and can be redirected to in the middle of a test. When a reusable snippet is added to a test, the snippet's starting URL is ignored by default, but select redirect if you'd like the tester to navigate to the reusable snippet's URL.

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 carrot icon next to Add a Step
  3. Select the Find an existing reusable snippet to embed option
  4. Either search or scroll to find the reusable snippet you plan to add (n.b. that only Plain Text Editor Snippets will appear here)

Editing Reusable Snippets

You can edit reusable snippets in one of two ways–

First, you can directly edit them via the Plain Text 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. To do this:

  1. Click the edit icon (pencil) next to the embedded snippet. 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 “Save” 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 Ttgs to reusable snippets

See Where Reusable Snippets Are Used

You can see where your reusable snippets are included in two places–

  1. In the Plain Text Editor you can see how many tests include that snippet under settings at the lower right part of the screen.

  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.

FAQs

Can reusable snippets be converted into tests or vice versa?
No, you can not directly covert a reusable snippet to a test. You can embed the reusable snippet in that test and then copy and paste steps directly into that new test.

To create a Snippet from a test, extract all the steps in the test to create a new Reusable Snippet.

Can I use a reusable snippet Created in the Visual Editor in a Plain Text Editor Test or vice versa?
No, tests can only include reusable snippets created in their respective editors.


If you have any questions, reach out to us at [email protected].