Skip to main content

How to write stories

In heal, test cases are called stories, because Heal's goal is to make them as close to user stories as possible.

Stories are made of steps, that the heal testing agent will execute against your website. Stories are defined in the test studio, an interactive playground where you can execute steps against your website interactively.

Test studio

warning

It's important to run all steps interactively in the studio at least once , because it allows you to check the test behaves as expected. While it's technically possible to add steps and save the story without running them, it will hurt performance.

Stories are uniquely defined by a story slug (the sluggified version of the name). Slugs are unique in each test suite.

Steps

Actions

An action is an instruction for heal's agent to execute a:

Actions have a target, and optionally a value. Make sure to read the guidelines on how to target elements. You can use inline javascript and variables inside action.

Actions in the heal studio

Running javascript

You can run a single line of javascript code inline or use a javscript step to run javascript in the context of the test browser running the test.

Assertions

You can use assertions to explicitly tell the heal agent to check something on your app. You can use inline javascript and variables inside action. There are two types of assertions:

Assertions

Simple assertions are deterministic. You can use them to check that the page text, URL, or title matches a certain text.

  • contains, equals, not equals and not contains compare the target to a string, and are case-insensitive.
  • matches, not matches evaluate a regex against the target.

AI assertions (beta)

Use AI assertions just like you would tell a tester to check for something, in natural language. Here are a few examples:

  • "Check that a new API key was created"
  • "Check that a red modal is visible on the screen"
  • "Check that there are only 2 search results"
  • "Check that the page is a dashboard with a search bar"

Other steps

Heal.dev allows to automate testing most functionality with more advanced steps. Ping us on twitter if you'd like to submit a request for another step type!

  • Verify email: fetch and submit a signup confirmation code sent over email, of fetch and submit a login OTP sent over email
  • Login with magic link: fetch and navigate to a magic link sent over email