---
title: "Install the TestDriver VS Code Extension"
sidebarTitle: "VS Code"
description: "Comprehensive guide to installing and setting up TestDriver for VS Code"
icon: "file-code"
---

<iframe
  className="w-full aspect-video rounded-xl"
  src="https://www.youtube.com/embed/dell_2tI6nc"
  title="YouTube video player"
  frameBorder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowFullScreen
></iframe>

The TestDriver VS Code extension is a powerful tool that integrates TestDriver's AI-driven test generation capabilities directly into your development environment:

- Get started with example scripts for different platforms
- Get syntax highlighting and autocompletion for [TestDriver YAML](/getting-started/editing)
- Chat with the TestDriver agent to generate tests based on your requirements
- Save and manage your tests directly within your project
- Run and debug tests directly from the IDE
- View test results and logs within the IDE

<Tip>
  The TestDriver VS Code Extension is currently in beta. If you encounter any
  issues or have feedback, please let us know [in
  Discord](https://discord.com/invite/cWDFW8DzPm)
</Tip>

<Steps>
  <Step title="Install the VS Code Extension">
    
    Click the button below to install the TestDriver extension for your preferred IDE. Then, follow the setup guide and chat with TestDriver to create your first test.

    <Card
      horizontal
      title="VS Code"
      arrow
      href="vscode:extension/testdriver.testdriver"
      icon="/images/content/extension/vscode.svg"
    ></Card>

    <Card
      horizontal
      title="Cursor"
      arrow
    href="cursor:extension/testdriver.testdriver"
    icon="/images/content/extension/cursor.svg"

    > </Card>

    <Card
      horizontal
      title="Windsurf"
      arrow
      href="windsurf:extension/testdriver.testdriver"
      icon="/images/content/extension/windsurf.svg"
    ></Card>

  </Step>
  <Step title="Set Your TestDriver API Key">
    
    After installing the extension, you'll need to set your TestDriver API key in the extension settings.

    1. Open the command palette (Cmd+Shift+P or Ctrl+Shift+P).
    2. Search for "Preferences: Open Settings (UI)" and select it.
    3. In the search bar, type "TestDriver" to filter the settings.
    4. Find the "TestDriver: Set API Key" field and enter your API key from [the TestDriver dashboard](https://app.testdriver.ai/team).

    <Tip>You can also set the `TD_API_KEY` environment variable in your system if you prefer not to enter it directly in the extension settings.</Tip>

  </Step>
  <Step title="Choose a Platform">
    Click on the TestDriver icon in the sidebar to open the extension panel and choose a platform to get started (Web, Desktop, or Mobile).
  </Step>
  <Step title="Create Your First Test">
    Now chat with the TestDriver agent to create your first test! Describe what you want to test, and the agent will generate the test steps for you.
  </Step>
  <Step title="Run your test">
    Run your test by clicking the "Run" button in the extension panel. You can view the test results and logs directly within VS Code's Test Explorer. [Learn more about running tests in VS Code](https://code.visualstudio.com/docs/debugtest/testing). 
  </Step>
</Steps>

---

**Pro Tip:** Always start with interactive mode (`testdriverai`) to explore and refine your tests before saving them. It's faster and more intuitive\!
