icon-test-automation

Get a Free Trial

Creating, executing, and maintaining reliable tests has never been easier.

Get Started

Mabl’s low-code test automation platform combines the intuitive ease of record-and-playback tools with modern features like AI and reusable JavaScript snippets to make tests more adaptable and more reliable. 

This approach allows teams to easily adopt and scale automated testing across their development organizations, regardless of coding experience. When certain steps are common, difficult, and/or time-consuming to recreate, you have the option to save the JavaScript snippet for reuse across your mabl Workspace.

Mabl makes it easy to create, manage, and share Javascript snippets for collaborative testing. Let’s look at some tried-and-true tips for harnessing these powerful tools for boosting quality collaboration. 

Build Your JavaScript Snippet Library in mabl 

Reusable JavaScript snippets can be inserted into any test, making it easier for manual testers, SDETs, QA engineers, and developers to collaborate on complex or specialized use cases. Any changes to the base flow will automatically be propagated to all tests containing that flow, reducing test maintenance even as your software testing strategy scales

Mabl’s test automation platform is designed to help your software testing team get even more value from cool JavaScript snippets. There are two ways to create JavaScript snippets in mabl: in the mabl Trainer and in the Snippet Editor. You can also find examples in our public GitHub repository to help get you started. 

Creating JavaScript snippets takes just a few steps in the mabl Trainer: 

  • Click on the plus icon to add a step.
  • Select JavaScript. The Configure snippet menu will appear in the Trainer window.
  • Click on the New button.
  • Write your snippet in the Snippet Editor. You may wish to run the snippet to check that it works as expected.
  • Click Save. You will have the option to save your snippet as a one-time or reusable snippet.
  • Click OK. The snippet will be added as a test step and run in the Trainer.

Your team also has the option to import snippets from a JavaScript snippet library, including mabl’s public repository. This JavaScript snippet example calls the browserBackButton function, which simulates hitting the back button in a browser window.

function mablJavaScriptStep(mablInputs, callback) {
setTimeout
(function(){ window.history.back() }, 1000);
callback(true);
}
As you build a library of JavaScript snippets and your product evolves, you may discover that teams need different versions of popular snippets. 

Easily Track and Manage Updates to JavaScript Snippets 

Managing new and updated versions of popular JavaScript snippets allows different teams across your organization to work on new features or fixes simultaneously without impacting each other. This supports continuous testing, DevOps adoption and CI/CD implementation

Versioning support can be accessed in the Snippets Editor. When editing a snippet from the Snippets page, you can now select and view older versions of the snippet. If you make any changes to the snippet, those modifications will be created as a new snippet version. This helps your team track updates to your snippets and easily revert to older versions without breaking changes.

Example snippet with version information at the top

Example snippet with version information at the top

Accessing older versions of a snippet can be accomplished in just a few steps:

  1. Go to the Snippets page: Tests > Snippets.
  2. Click on a snippet.
  3. The Snippet Editor includes a new dropdown displaying information about the currently selected snippet version. Click on that bar to select and view an older version of the snippet.

Click on the bar to view older versions of the snippet

Click on the bar to view older versions of the snippet

Saving automatically creates a new version of that snippet based on the currently visible values of the snippet parameters and code.

 

This feature is generally available for all customers and trial users in the mabl app. Note that snippet change history is only accessible for snippets edited in the Snippets page. Although saving a snippet in the mabl Trainer does create a new snippet version, the Snippet Editor in the mabl Trainer does not include the version dropdown.

Versioning support for JavaScript snippets empowers software development organizations to get even more value from their JavaScript snippet library in mabl. Democratize testing, share expertise across your software testing team, and embrace DevOps with JavaScript snippets.

How JavaScript Snippets Unleashed Automated Testing for Wurl

JavaScript snippets are a valuable tool for scaling automated testing, especially when teams include a variety of coding expertise and testing experiences. For Wurl, harnessing JavaScript snippets in mabl made it possible to scale automated testing for video validation. 

One of Wurl’s QA engineers built an automation suite that can validate both the timing of ad placements and the accuracy of any associated captions. The automation suite relies on JavaScript snippets to control video player actions, making it possible to test these nuanced scenarios that would otherwise be difficult to manage. 

Using a custom JavaScript snippet, the team is able to capture a base64 image of a video player as part of the test execution. That image is then converted to a JSON object via API, so team members can review the test steps, flows, parameters, and results, making it easier to triage failed tests. With this approach, 70-80% playback-related test cases can be covered, freeing up the team to focus on high-impact manual testing and ship releases faster. 

Mabl’s low-code test automation platform allowed Wurl to evolve their quality team from mostly manual testing to an expansive quality engineering practice that includes automated regression testing and smoke testing. 

Though Wurl’s team, their product, and their customer needs have changed significantly since starting with mabl in 2019, mabl’s highly customizable approach to low-code has ensured that Wurl gets the most value from their software testing strategy at every turn. JavaScript snippets have been a critical part of that value. 

Build a Collaborative Software Testing Practice with JavaScript Snippets

Software testing plays a critical role in accelerating deployment frequency, improving DevOps performance, customer retention, and adopting AI for software development. With mabl, your team has a test automation platform designed to match these demands and empower your quality team to extend your impact across the business. 

JavaScript snippets bridge the gap between the ease of low-code test creation and enabling everyone to execute tests for complex scenarios. Easily create and manage JavaScript snippets within mabl for an adaptable, scalable software testing strategy that works for developers, QA engineers, and manual testers in one platform. 

Start your free 14 day trial with mabl and see how low-code test automation can empower your team.