Skip to main content

How to Use Discovery Prompts?

Discovery Prompts let Thunder Code decide actions at runtime, ideal for dynamic content, user flows, or unclear steps.

H
Written by Help
Updated over 2 weeks ago

Discovery Prompts are designed to handle situations where it’s not possible to define exactly what actions should be taken ahead of time. These special steps allow Thunder Code to decide what to do at runtime, based on the content of your web application. This makes them ideal for handling dynamic content, user-driven flows, or unclear instructions.

What You'll Learn

  • What Discovery Prompts and Discovered Steps are

  • How to create and use them in your Test Cases

  • How to handle site changes with Auto-Heal

  • Best practices for writing effective Discovery Prompts

What are Discovery Prompts?

Discovery Prompts are special steps where the specific actions to be taken are not compiled until runtime. That means their behaviour is determined on the fly based on the structure and content of your site when the test runs.

Once a Discovery Prompt is executed, Thunder Code will automatically generate a list of “Discovered Steps” under it that reflect the actual actions performed. From then on, the original step is marked as a special step and will be skipped during future test runs. Only the generated discovery steps will be executed.

If your website’s content changes, you can regenerate the discovery steps by clicking the Auto-Heal button. This will trigger Thunder Code to rebuild the discovery steps during the next execution.

How to Create a Discovery Prompt

Creating a Discovery Prompt is the same as creating any other step:

  • Open your Test Case: Navigate to the Test Case where you want to add a Discovery Prompt.

  • Add a new step or describe the action in chat:

    • Example: “Click on all the buttons”

  • Execute your Test Case:

    • On first execution, Thunder Code will interpret the step based on the site’s content and generate Discovered Steps accordingly.

    • The step will then be marked as a Discovery Prompt and skipped in the next Test Runs, moving directly to the Discovered Steps.

  • Edit a Discovery Prompt:

    If you change the content of a Discovery Prompt, all its existing Discovered Steps will be removed. New Discovered Steps will be generated on the next execution.

  • Delete a Discovery Prompt:

    Deleting a Discovery Prompt will also delete all of its associated Discovered Steps automatically.

  • Discovered Steps Organization:

    Discovered Steps remain tightly coupled to their parent Discovery Prompt:

    • You cannot drag and drop a Discovered Step outside its parent.

    • You cannot drag other steps into a Discovery Prompt.

    • A red border will appear on the step being dragged whenever the drag-and-drop operation is not allowed.

What Happens When Content Changes?

If the content or layout of your website changes and the existing Discovered Steps no longer apply, just click the Heal button to delete those. On the next execution, Thunder Code will regenerate new actions under the Discovery Prompt based on the new content.

Use Cases

  • Loops: When you want to repeat an action for multiple elements on the page

    Example: Click on all the buttons and verify they work

  • Unclear steps: When the interaction type isn’t known in advance

    Example: Change the language to French

    Example: Fill the form

Tips for Writing Effective Discovery Prompt

  • Include both actions and assertions in the same step.

    This guarantees that your steps will be executed in the right order.

    Example: Click on each card and verify a description field appears

  • Avoid giving a specific action (click, select, type) in the instruction.

    Let the system determine the appropriate interaction.

    Instead of: Select French for language

    Use: Change the language to French

  • Describe the user goal, not the implementation.

    Keep your instructions at a high level so Thunder Code can adapt to the UI.

Did this answer your question?