Skip to main content
This guide explains how to convert Gherkin scenarios into TestDriver prompts for use in your testing workflows. By following this process, you can easily adapt existing Gherkin test cases into a format compatible with TestDriver.

What’s Gherkin?

Gherkin is a plain-text language used to describe test scenarios in a human-readable format. It uses keywords like Given, When, Then, and And to define steps in a test.

Example Gherkin scenario:


What are TestDriver prompts?

TestDriver prompts are high-level instructions that describe what the AI should do. They’re written in plain text and focus on user actions or expected outcomes.

Example prompts:


Steps to convert Gherkin to TestDriver prompts

Step 1: Understand the mapping


Step 2: Extract steps from Gherkin

Take each step from the Gherkin scenario and rewrite it as a plain-text prompt. Remove the Given, When, Then, and And keywords, and focus on the action or expectation.

Example:


Step 3: Write the prompts in YAML format

Combine the extracted prompts into a YAML file. Each step should be written as a prompt entry.

Example YAML:


Step 4: Save the YAML file

  1. Save the YAML content to a file (for example, login_test.yaml).
  2. Ensure the file is stored in the appropriate directory for your TestDriver project (for example, testdriver/).

Step 5: Run the test with TestDriver

Use the TestDriver CLI to execute the test.

Command:


Example: Full conversion workflow

Input Gherkin scenario:

Converted YAML:

Run the test:


Best practices

  1. Keep Prompts Simple: Focus on high-level actions or outcomes. Avoid including unnecessary details.
  2. Use Descriptive Prompts: Ensure each prompt clearly describes the action or expectation.
  3. Test the YAML: Run the converted YAML file to verify that it works as expected.
  4. Organize Files: Store YAML files in a structured directory (for example, testdriver/) for easy management.

By following this guide, you can efficiently convert Gherkin scenarios into TestDriver prompts, enabling seamless integration of existing test cases into your TestDriver workflows.