You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/ci.mdx
+39-49Lines changed: 39 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,20 @@ This guide explains how to set up TestDriver in CI/CD pipelines, using **GitHub
9
9
10
10
## Prerequisites
11
11
12
-
1.**TestDriver API Key**: Obtain your API key from TestDriver and store it as a CI/CD secret (for example, `TD_API_KEY` in GitHub Actions).
12
+
1.**Add API key to secrets**: Obtain your API key from TestDriver and store it as a [CI/CD secret](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets) as `TD_API_KEY`.
13
+
Also make sure to add the `TD_WEBSITE` secret to the repository with the value of the website you are testing if its a web based application.
13
14
2.**Test Files**: Ensure your test files are saved in the `testdriver/` directory of your repository.
14
15
15
16
## Create a CI/CD workflow
16
17
17
18
This example uses GitHub Actions, but the same approach can be adapted for other CI/CD platforms:
18
19
19
20
1. Create a new file in your repository: `.github/workflows/testdriver.yaml`.
21
+
22
+
<Note>
23
+
If you have already [initialized the project](/getting-started/setup) with `npx testdriverai@latest init`, the workflow file will already be created.
24
+
</Note>
25
+
20
26
2. Add the following workflow configuration:
21
27
22
28
### Example GitHub Actions workflow
@@ -33,64 +39,23 @@ on:
33
39
- cron: '0 13 * * *'# Every day at 1 PM UTC (adjust if needed for timezone)
1. Navigate to the **Actions** tab in your GitHub repository (or equivalent CI/CD dashboard).
105
-
2. Select the workflow run to view the test results.
70
+
2. Select the workflow run to view the test results. You will also find the link to the test recording at the end of the run, the url is of the format: `https://app.dashcam.io/replay/1234567890`
71
+
72
+
<Tip>
73
+
You can also intregate our supported [reporting platform](/exporting/junit) to get more currated results.
74
+
</Tip>
106
75
107
76
<Note>
108
77
For other CI/CD platforms, adapt the workflow syntax to match your platform's
@@ -153,3 +122,24 @@ TestDriver provides a powerful debugging interface through its platform. This in
153
122
154
123
- Share test results with your team by generating a shareable link.
155
124
- Add comments or annotations to specific steps to facilitate discussions and debugging.
125
+
126
+
---
127
+
128
+
## How it works
129
+
130
+
1. **Trigger**: The GitHub workflow is triggered based on the conditions defined in the `on` section.
131
+
2. **Fetch the test files**: The test files are fetched from the repository based off the current branch.
132
+
3. **Running the tests**: The TestDriver CLI is installed and the tests are run via the `run` command.
133
+
4. **Authentication**: The `TD_API_KEY` environment variable authenticates your account.
134
+
5. **Dashcam Recording**: Dashcam begins recording the test execution.
135
+
6. **Test Execution**: The TestDriver CLI executes your commands on the cloud VM.
136
+
8. **Test Summary**: TestDriver summarizes the test and sets the exit code based on the pass or fail state.
137
+
9. **Cleanup**: The recording is uploaded to the TestDriver platform and the VM is destroyed, and all data is wiped.
138
+
139
+
---
140
+
141
+
## Additional features
142
+
143
+
- **Parallel testing**: You can run multiple tests in [parallel](/features/parallel-testing#setting-up-parallel-testing-with-a-matrix-strategy). The number of parallel instances depends on the plan you are on.
144
+
- **Environment Variables**: Pass [custom environment variables](guide/authentication#step-2%3A-pass-credentials-to-the-workflow) to configure credentials that are required for the tests.
145
+
- **Chaining Workflows**: A common workflow involves waiting for staging to deploy and testing against the staging environment by passing in the deployed url as `TD_WEBSITE` or the staging build's installation url depending on the kind of application you are testing.
Explore the available commands and their parameters.
16
12
</Card>
@@ -27,12 +23,12 @@ Use your preferred text editor or IDE (for example, Visual Studio Code) to open
27
23
28
24
Each test file consists of:
29
25
30
-
-**Version**: Specifies the TestDriver version.
26
+
-**Version**: Specifies the TestDriver version that was used to generate the test file. This is used to lock the version of TestDriver that is used to run the test.
31
27
-**Session**: A unique identifier for the test session.
32
28
-**Steps**: A list of prompts and commands to execute.
33
29
34
-
```yamltestfile.yaml
35
-
version: 4.2.18
30
+
```yamltest-file.yaml
31
+
version: 6.0.0
36
32
session: abc1234
37
33
steps:
38
34
- prompt: Open Google Chrome and navigate to Airbnb
@@ -46,7 +42,8 @@ steps:
46
42
- command: type
47
43
text: airbnb.com
48
44
- command: press-keys
49
-
keys: [enter]
45
+
keys:
46
+
- enter
50
47
```
51
48
52
49
<Tip>
@@ -61,7 +58,7 @@ steps:
61
58
You can add, edit, or remove steps as needed. Each step contains:
62
59
63
60
- **Prompt**: A description of the action.
64
-
- **Commands**: The specific actions to perform.
61
+
- **Commands**: The specific actions to perform. It is an **optional** field, meaning, if there are no `commands` the AI considers the `prompt` and generates and executes the yaml on-the-go using the [exploratory mode](/interactive/explore)
65
62
66
63
#### Example edits:
67
64
@@ -86,7 +83,11 @@ Ensure the YAML file is properly formatted:
86
83
87
84
- Use consistent indentation (2 spaces recommended).
88
85
- Avoid trailing spaces or tabs.
89
-
- Validate the file using a YAML linter if needed.
86
+
- TestDriver will validate the yaml syntax and provide suggestions to fix any errors when you run the test.
87
+
88
+
<Tip>
89
+
It is recommended to use our [VS Code extension](/getting-started/vscode) while you are editing the yaml. It will provide you with a rich experience with auto-completion, syntax highlighting, and validation.
Copy file name to clipboardExpand all lines: docs/getting-started/running.mdx
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,20 +17,24 @@ npx testdriverai@latest run path/to/test.yaml
17
17
18
18
This will execute the test script located at `path/to/test.yaml`. If the test passes, the command will exit with a status code of `0`. If it fails, the command will exit with a status code of `1`.
19
19
20
+
<Note>
21
+
The path to the test file provided should be relative to the current working directory.
0 commit comments