Test scripts are written in YAML format, making them easy to read and modify manually if you need to.

TestDriver v5 uses the .yaml file extension for all test files. This is a breaking change from v4 which uses the .yml extension!

Commands Reference

Explore the available commands and their parameters.

Locate the Test File

TestDriver test files are typically stored in the testdriver/ directory of your project. The default file is testdriver/testdriver.yaml.

Open the Test File

Use your preferred text editor or IDE (for example, Visual Studio Code) to open the YAML file.

YAML Structure

Each test file consists of:

  • Version: Specifies the TestDriver version.
  • Session: A unique identifier for the test session.
  • Steps: A list of prompts and commands to execute.
testfile.yaml
version: 4.2.18
session: abc1234
steps:
  - prompt: Open Google Chrome and navigate to Airbnb
    commands:
      - command: focus-application
        name: Google Chrome
      - command: hover-text
        text: Search Google or type a URL
        description: main google search
        action: click
      - command: type
        text: airbnb.com
      - command: press-keys
        keys: [enter]
The version captured when you generate a test file is the version of TestDriver you used, and isn’t used when running the test. This doesn’t affect your ability to use newer versions of TestDriver on existing test files nor do these need to be updated when migrating to a new version.

Modify the test steps

You can add, edit, or remove steps as needed. Each step contains:

  • Prompt: A description of the action.
  • Commands: The specific actions to perform.

Example edits:

  • Add a Wait Command:
    - command: wait
      timeout: 3000
    
  • Change the URL: Update the text field in the type command:
    - command: type
      text: booking.com
    

Validate the YAML syntax

Ensure the YAML file is properly formatted:

  • Use consistent indentation (2 spaces recommended).
  • Avoid trailing spaces or tabs.
  • Validate the file using a YAML linter if needed.

Test the changes

Run the updated test to verify it works as expected:

testdriverai run path/to/test.yaml