Reusable JavaScript Snippets

6 months ago by Mike DeCosta

We're happy to announce mabl now has the ability to create reusable javascript steps called snippets. While training any step that includes javascript code, you'll be given the option to save that javascript text as a snippet. Then that snippet can be loaded into any of your other javascript steps within the trainer without having to write that same script again, no more copy and paste.

Create a new snippet

Create a new snippet

The great thing is, when you use the same snippet in multiple journeys (or twice within the same journey), any updates to that snippet anywhere will propagate to all the places using that snippet reducing maintenance of your custom javascript.

In addition to this change, we've added a javascript editor into the mabl dashboard UI so you can update your snippets everywhere without having to load the trainer! You can find the snippets you've created by going to Journeys then opening the Snippets pane. There you'll be able to create new ones, edit existing ones, and delete any that are no longer useful.

Snippets dashboard

Snippets dashboard

Create a new snippet

Create a new snippet

You'll be able to convert any one time use javascript step into a snippet by simply editing the existing step, and saving the step as a new snippet. You'll also have the ability to continue to use javascript in your steps without making them snippets. Happy testing!