---
title: Using TestDriver with Desktop Apps
sidebarTitle: "Desktop Apps"
description: "TestDriver is designed to work with any desktop application, including Electron, Java, and .NET apps."
icon: "desktop"
---

import TestPrereqs from "/snippets/test-prereqs.mdx";

<iframe
  width="600"
  height="400"
  src="https://www.youtube.com/embed/DzgZf2b5XJs"
  title="Assert 2+2=4"
  frameborder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen
></iframe>
--- # Using TestDriver with Desktop Apps

TestDriver is designed to work with any desktop application, including Electron, Java, and .NET apps. This guide provides an overview of how to use TestDriver with desktop applications, including installation, configuration, and running tests.

<TestPrereqs />

## Sample test steps

1. **Launch the application**: Use the [`exec`](/commands/exec) command to launch the application. You can specify the path to the executable file and any command-line arguments needed to start the application.
2. **Wait for the application to load**: Use the [`wait-for-text`](/commands/wait-for-text) command to wait for a specific text or element to appear in the application window. This ensures that the application is fully loaded before proceeding with the test.
3. **Interact with the application**: Use the [`focus-application`](/commands/focus-application) command to bring the application window to the foreground. Then, use the [`hover-image`](/commands/hover-image) command to interact with specific elements in the application, such as buttons or text fields.
4. **Perform actions**: Use the [`hover-image`](/commands/hover-image) command to click on buttons or enter text in input fields. You can also use the [`wait-for-text`](/commands/wait-for-text) command to verify that the expected output appears after performing an action.
5. **Verify results**: Use the [`assert`](/commands/assert) command to check if the expected result matches the actual output. This step is crucial for validating the functionality of the application.

## Supported desktop applications

TestDriver supports a wide range of desktop applications, including:

- Electron apps
- Java apps
- .NET apps
- Native Windows applications
- Native Mac applications
- Native Linux applications
- Any other desktop application that can be run on Windows, Mac, or Linux

---

## Installation

To use TestDriver with desktop applications, no special setup is needed. Simply run the local agent to interact with applications on your local machine, or add instructions to `provision.yaml` to tell the runner to launch or install the application. Here is an example that performs a calculation on a calculator app:

```yaml testdriver/lifecycle/provision.yaml
version: 6.0.0
steps:
  - prompt: launch a calculator
    commands:
      - command: exec
        lang: pwsh
        code: |
          start /B calc.exe
          timeout /t 5
      - command: wait-for-text
        text: "calculator"
        timeout: 30000
```

A `calculator.yaml` file might look like this:

```yaml calculator.yaml
version: 6.0.0
steps:
  - prompt: perform the operation 2 + 2 = on the calculator that is opened
    commands:
      - command: focus-application
        name: galculator
      - command: hover-image
        description: button with number 2 on the calculator
        action: click
      - command: hover-image
        description: plus button on the calculator
        action: click
      - command: hover-image
        description: button with number 2 on the calculator
        action: click
      - command: hover-image
        description: equals button on the calculator
        action: click
      - command: assert
        expected: 4 is displayed as the result
```

## Conclusion

TestDriver is a powerful tool for automating tests for desktop applications. With its support for a wide range of desktop platforms and its easy-to-use interface, you can quickly set up and run tests for your applications. Whether you are testing Electron apps, Java apps, or any other desktop application, TestDriver provides the tools you need to ensure your applications work as expected.
