Local Development
You can create and deploy end-to-end tests in just a few minutes by running a couple of terminal commands, then teaching TestDriver what to do on your local machine.
Introduction
Making tests with TestDriver is super easy! Just show TestDriver what to test on your local machine and upload the resulting test plan. Then TestDriver will repeat the test on it's own machine on every commit!
For this example, we'll be testing an example todo app. The live site is here, and the source for this quick start is here.
TestDriver is not limited to web apps! It has full control of the desktop so you can test desktop apps, browser extensions, or anything else!
Prerequisites
You'll need NodeJS version 20 to get started. Windows users will need a couple extra tools.
Install tools with Chocolatey
Install Python & Visual Studio Build Tools
Install NodeJS
You will also need NodeJS if you don't have it yet.
Set Execution Policy
Open a new terminal with admin privileges and execute the following command :
This gives TestDriver the right to execute it's scripts and is only valid for the current user.
Setup
Install TestDriver via NPM
Install testdriverai
via NPM. This will make testdriverai
available as a global command.
Set up the project
Make a new folder. In the root of the folder, run testdriverai init
. This will configure your TestDriver experience and set up a basic GitHub runner workflow.
If you are working with a single display, we recommend enabling desktop notifications and speech narration.
You're almost ready to deploy your first test!
Set up your test environment
Before we get started, let's set up your machine to collaborate with TestDriver.
Display
TestDriver isn't like any framework you've used before. TestDriver makes decisions based on what it can see on your display!
TestDriver only knows about what it can see on your primary display!
For now, set up your environment with a browser window and your terminal side by side like so:
When you enter commands into TestDriver, the focus-window
command will bring Chrome or other applications to the foreground.
Enabling TD_SPEAK
and TD_NOTIFY
will help you understand what TestDriver is doing when the terminal is not visible.
Application State
The application you want to test should be visible before you run the testdriverai
command.
When TestDriver runs tests on it's own machine, we'll use a prerun.sh
script to build and launch the app. For now though, it's easier to do it yourself.
For our example, make a new incognito window in Chrome and load our test webpage:
Teach TestDriver
It's time to test! The following command will launch TestDriver in interactive mode. TestDriver will generate test commands and save them totestdriver/test.yml
.
Instruct TestDriver
Now, just tell TestDriver what you want it to do. For our example, try click new task
.
Later, we'll use /explore
to perform higher level objectives like "make a new task"
TestDriver Generates a Test
TestDriver will look at your screen and generate a test script. TestDriver can see the screen, control the mouse, keyboard, and more!
TestDriver executes the test script
TestDriver will execute the command
s found in the yml
codeblocks of the response.
See the yml
TestDriver generated? That's our own schema. You can learn more about it in the YML Schema.
Take your hands off the mouse and keyboard while TestDriver executes! TestDriver is not a fan of backseat drivers.
Keep going!
Feel free to ask TestDriver to perform some more tasks. Every time you prompt TestDriver it will look at your screen and generate more test step to complete your goal.
Save the test
If everything worked perfectly, use the
/save
command to save the test script to the current file.If something didn't work, you can use
/undo
to remove all of the test steps added since the last prompt.
Test the test locally
Now it's time to make sure the test plan works before we deploy it. Use testdriver run
to run the test file you just created with /save
.
Make sure to reset the test state!
Deploy
Now it's time to deploy your test using our GitHub action! testdriver init
already did the work for you and will start triggering tests once you commit the new files to your repository.
Your test will run on every commit and the results will be posted as a Dashcam.io video within your GitHub summary!
You must add your TESTDRIVER_API_KEY as a GitHub secret in your repository
Last updated