testdriverai 5.3.12 → 5.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent.js +21 -18
- package/docs/30x30.mdx +1 -1
- package/docs/action/secrets.mdx +1 -1
- package/docs/commands/assert.mdx +4 -4
- package/docs/commands/exec.mdx +33 -23
- package/docs/commands/focus-application.mdx +3 -3
- package/docs/commands/hover-image.mdx +6 -6
- package/docs/commands/hover-text.mdx +3 -3
- package/docs/commands/if.mdx +1 -1
- package/docs/commands/match-image.mdx +4 -4
- package/docs/commands/run.mdx +1 -1
- package/docs/commands/scroll-until-image.mdx +6 -3
- package/docs/commands/scroll-until-text.mdx +3 -3
- package/docs/commands/type.mdx +1 -1
- package/docs/commands/wait-for-image.mdx +1 -1
- package/docs/commands/wait-for-text.mdx +1 -1
- package/docs/docs.json +1 -1
- package/docs/features/auto-healing.mdx +1 -1
- package/docs/features/cross-platform.mdx +1 -1
- package/docs/features/generation.mdx +76 -142
- package/docs/features/parallel-testing.mdx +1 -1
- package/docs/features/selectorless.mdx +1 -1
- package/docs/getting-started/generating.mdx +90 -30
- package/docs/getting-started/vscode.mdx +1 -1
- package/docs/guide/assertions.mdx +1 -1
- package/docs/guide/authentication.mdx +10 -26
- package/docs/guide/code.mdx +31 -141
- package/docs/guide/lifecycle.mdx +41 -0
- package/docs/guide/locating.mdx +1 -1
- package/docs/guide/variables.mdx +35 -121
- package/docs/guide/waiting.mdx +26 -101
- package/docs/interactive/assert.mdx +2 -2
- package/docs/interactive/undo.mdx +1 -1
- package/docs/overview/what-is-testdriver.mdx +1 -1
- package/docs/quickstart.mdx +3 -1
- package/docs/security/action.mdx +2 -2
- package/docs/security/agent.mdx +4 -4
- package/docs/security/platform.mdx +1 -1
- package/lib/init.js +0 -1
- package/lib/upload-secrets.js +1 -0
- package/package.json +3 -3
- package/styles/.vale-config/2-MDX.ini +5 -0
- package/styles/Microsoft/AMPM.yml +9 -0
- package/styles/Microsoft/Accessibility.yml +30 -0
- package/styles/Microsoft/Acronyms.yml +64 -0
- package/styles/Microsoft/Adverbs.yml +272 -0
- package/styles/Microsoft/Auto.yml +11 -0
- package/styles/Microsoft/Avoid.yml +14 -0
- package/styles/Microsoft/Contractions.yml +50 -0
- package/styles/Microsoft/Dashes.yml +13 -0
- package/styles/Microsoft/DateFormat.yml +8 -0
- package/styles/Microsoft/DateNumbers.yml +40 -0
- package/styles/Microsoft/DateOrder.yml +8 -0
- package/styles/Microsoft/Ellipses.yml +9 -0
- package/styles/Microsoft/FirstPerson.yml +16 -0
- package/styles/Microsoft/Foreign.yml +13 -0
- package/styles/Microsoft/Gender.yml +8 -0
- package/styles/Microsoft/GenderBias.yml +42 -0
- package/styles/Microsoft/GeneralURL.yml +11 -0
- package/styles/Microsoft/HeadingAcronyms.yml +7 -0
- package/styles/Microsoft/HeadingColons.yml +8 -0
- package/styles/Microsoft/HeadingPunctuation.yml +13 -0
- package/styles/Microsoft/Headings.yml +28 -0
- package/styles/Microsoft/Hyphens.yml +14 -0
- package/styles/Microsoft/Negative.yml +13 -0
- package/styles/Microsoft/Ordinal.yml +13 -0
- package/styles/Microsoft/OxfordComma.yml +8 -0
- package/styles/Microsoft/Passive.yml +183 -0
- package/styles/Microsoft/Percentages.yml +7 -0
- package/styles/Microsoft/Plurals.yml +7 -0
- package/styles/Microsoft/Quotes.yml +7 -0
- package/styles/Microsoft/RangeTime.yml +13 -0
- package/styles/Microsoft/Semicolon.yml +8 -0
- package/styles/Microsoft/SentenceLength.yml +7 -0
- package/styles/Microsoft/Spacing.yml +8 -0
- package/styles/Microsoft/Suspended.yml +7 -0
- package/styles/Microsoft/Terms.yml +42 -0
- package/styles/Microsoft/URLFormat.yml +9 -0
- package/styles/Microsoft/Units.yml +16 -0
- package/styles/Microsoft/Vocab.yml +25 -0
- package/styles/Microsoft/We.yml +11 -0
- package/styles/Microsoft/Wordiness.yml +127 -0
- package/styles/Microsoft/meta.json +4 -0
- package/styles/alex/Ablist.yml +245 -0
- package/styles/alex/Condescending.yml +16 -0
- package/styles/alex/Gendered.yml +108 -0
- package/styles/alex/LGBTQ.yml +55 -0
- package/styles/alex/OCD.yml +10 -0
- package/styles/alex/Press.yml +11 -0
- package/styles/alex/ProfanityLikely.yml +1289 -0
- package/styles/alex/ProfanityMaybe.yml +282 -0
- package/styles/alex/ProfanityUnlikely.yml +251 -0
- package/styles/alex/README.md +27 -0
- package/styles/alex/Race.yml +83 -0
- package/styles/alex/Suicide.yml +24 -0
- package/styles/alex/meta.json +4 -0
- package/styles/config/vocabularies/Docs/accept.txt +6 -0
- package/styles/proselint/Airlinese.yml +8 -0
- package/styles/proselint/AnimalLabels.yml +48 -0
- package/styles/proselint/Annotations.yml +9 -0
- package/styles/proselint/Apologizing.yml +8 -0
- package/styles/proselint/Archaisms.yml +52 -0
- package/styles/proselint/But.yml +8 -0
- package/styles/proselint/Cliches.yml +782 -0
- package/styles/proselint/CorporateSpeak.yml +30 -0
- package/styles/proselint/Currency.yml +5 -0
- package/styles/proselint/Cursing.yml +15 -0
- package/styles/proselint/DateCase.yml +7 -0
- package/styles/proselint/DateMidnight.yml +7 -0
- package/styles/proselint/DateRedundancy.yml +10 -0
- package/styles/proselint/DateSpacing.yml +7 -0
- package/styles/proselint/DenizenLabels.yml +52 -0
- package/styles/proselint/Diacritical.yml +95 -0
- package/styles/proselint/GenderBias.yml +45 -0
- package/styles/proselint/GroupTerms.yml +39 -0
- package/styles/proselint/Hedging.yml +8 -0
- package/styles/proselint/Hyperbole.yml +6 -0
- package/styles/proselint/Jargon.yml +11 -0
- package/styles/proselint/LGBTOffensive.yml +13 -0
- package/styles/proselint/LGBTTerms.yml +15 -0
- package/styles/proselint/Malapropisms.yml +8 -0
- package/styles/proselint/Needless.yml +358 -0
- package/styles/proselint/Nonwords.yml +38 -0
- package/styles/proselint/Oxymorons.yml +22 -0
- package/styles/proselint/P-Value.yml +6 -0
- package/styles/proselint/RASSyndrome.yml +30 -0
- package/styles/proselint/README.md +12 -0
- package/styles/proselint/Skunked.yml +13 -0
- package/styles/proselint/Spelling.yml +17 -0
- package/styles/proselint/Typography.yml +11 -0
- package/styles/proselint/Uncomparables.yml +50 -0
- package/styles/proselint/Very.yml +6 -0
- package/styles/proselint/meta.json +17 -0
- package/styles/write-good/Cliches.yml +702 -0
- package/styles/write-good/E-Prime.yml +32 -0
- package/styles/write-good/Illusions.yml +11 -0
- package/styles/write-good/Passive.yml +183 -0
- package/styles/write-good/README.md +27 -0
- package/styles/write-good/So.yml +5 -0
- package/styles/write-good/ThereIs.yml +6 -0
- package/styles/write-good/TooWordy.yml +221 -0
- package/styles/write-good/Weasel.yml +29 -0
- package/styles/write-good/meta.json +4 -0
- package/testdriver/testdriver_2025-04-17T16-04-30-454Z.yaml +6 -0
- package/vale.ini +18 -0
- package/docs/guide/setup-teardown.mdx +0 -162
- package/docs/reference/interactive/assert.mdx +0 -0
- /package/{docs/reference/commands/scroll.mdx → styles/config/vocabularies/Docs/reject.txt} +0 -0
|
@@ -4,177 +4,111 @@ sidebarTitle: "Test Generation"
|
|
|
4
4
|
description: "Simplify test creation with AI-driven exploratory testing."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **TestRail test cases**
|
|
9
|
-
- **CSV files**
|
|
10
|
-
- **Jira tickets**
|
|
11
|
-
- **Gherkin scenarios**
|
|
7
|
+
Writing tests can be a tedious and time-consuming task. TestDriver.ai can generate tests just by exploring your app! This guide will show you how to generate tests using TestDriver.ai.
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
# Generate Exploratory Tests
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Launch `testdriverai` in interactive mode with the following command:
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
```bash
|
|
14
|
+
testdriverai
|
|
15
|
+
```
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
TestDriver will boot up.
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
```bash
|
|
20
|
+
❯ testdriverai
|
|
21
|
+
Howdy! I'm TestDriver v5.3.11
|
|
22
|
+
```
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
A script can parse the CSV file and convert each row into a YAML test file.
|
|
24
|
+
Ensure your website or app is visible on your test runner's display.
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
version: 4.2.18
|
|
32
|
-
steps:
|
|
33
|
-
- prompt: Open login page
|
|
34
|
-
- prompt: Enter valid credentials
|
|
35
|
-
- prompt: Click "Log In" button
|
|
36
|
-
- prompt: Verify that the dashboard is displayed
|
|
26
|
+
Then, run the `generate` command.
|
|
37
27
|
|
|
28
|
+
```bash
|
|
29
|
+
/generate web 10
|
|
38
30
|
```
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
Use a Node.js or Python script to automate the conversion process. The script reads the CSV file, extracts the test cases, and generates YAML files for each test.
|
|
32
|
+
This will generate 10 tests within the `testdriver/generate` directory. You can change the number of tests generated by changing the number after `10`. The generated tests will be in the form of a `.js` file, and you can run them using your test runner of choice.
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
```bash
|
|
35
|
+
> /generate web 5
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
thinking...
|
|
38
|
+
```
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
Jira tickets often contain **user stories** or **acceptance criteria** that can be converted into test cases. By using the Jira API, you can fetch tickets and extract relevant fields like the title, description, and acceptance criteria.
|
|
40
|
+
Now your directory structure will look like this:
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
```bash
|
|
43
|
+
testdriver
|
|
44
|
+
├── generate
|
|
45
|
+
│ ├── test-error-user-login.yaml
|
|
46
|
+
│ ├── test-locked-out-user-login.yaml
|
|
47
|
+
│ ├── test-navigation-to-shop-page.yaml
|
|
48
|
+
│ ├── test-problem-user-login.yaml
|
|
49
|
+
│ └── test-standard-user-login.yaml
|
|
50
|
+
```
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
Each acceptance criterion can be converted into a `prompt` in a YAML test file.
|
|
52
|
+
Notice that each test file has no commands! It's only a list of prompts. This is similar to an exploratory test.
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
version:
|
|
54
|
+
```yaml
|
|
55
|
+
version: 5.3.11
|
|
62
56
|
steps:
|
|
63
|
-
- prompt:
|
|
64
|
-
- prompt:
|
|
65
|
-
- prompt:
|
|
66
|
-
|
|
57
|
+
- prompt: Fill in the "Username" field with "error_user".
|
|
58
|
+
- prompt: Fill in the "Password" field with "secret_password".
|
|
59
|
+
- prompt: Click the "Sign in" button.
|
|
60
|
+
- prompt: Assert that there are issues during checkout and an error is displayed.
|
|
67
61
|
```
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
Use a script to fetch Jira tickets via the Jira API, extract the acceptance criteria, and generate YAML files.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## 3. **Test Generation from Gherkin Scenarios**
|
|
63
|
+
# Generate Regression Tests from Exploratory Tests
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
Gherkin scenarios, commonly used with tools like Cucumber, describe test cases in a human-readable format using keywords like `Given`, `When`, and `Then`.
|
|
65
|
+
Now it's time to generate the regression test.
|
|
78
66
|
|
|
79
|
-
|
|
80
|
-
Scenario: Successful login
|
|
81
|
-
Given the user is on the login page
|
|
82
|
-
When the user enters valid credentials
|
|
83
|
-
And clicks the "Log In" button
|
|
84
|
-
Then the user should see the dashboard
|
|
85
|
-
|
|
86
|
-
```### Conversion to TestDriver.ai YAML
|
|
87
|
-
Each Gherkin step can be mapped to a `prompt` in a YAML test file.
|
|
88
|
-
|
|
89
|
-
#### Example YAML:```yaml
|
|
90
|
-
version: 4.2.18
|
|
91
|
-
steps:
|
|
92
|
-
- prompt: The user is on the login page
|
|
93
|
-
- prompt: The user enters valid credentials
|
|
94
|
-
- prompt: Clicks the "Log In" button
|
|
95
|
-
- prompt: The user should see the dashboard
|
|
67
|
+
Run the tests with the `run` command and use the `--save` parameter:
|
|
96
68
|
|
|
69
|
+
```bash
|
|
70
|
+
testdriverai run testdriver/generate/test-error-user-login.yaml --save
|
|
97
71
|
```
|
|
98
72
|
|
|
99
|
-
|
|
100
|
-
A script can parse Gherkin files, map the steps to prompts, and generate YAML files.
|
|
101
|
-
|
|
102
|
-
---
|
|
73
|
+
When a test has no `commands`, TestDriver falls back to the `prompt`.
|
|
103
74
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
75
|
+
```
|
|
76
|
+
> Fill in the "Username" field with "error_user".
|
|
77
|
+
No commands found, running exploratory
|
|
78
|
+
```
|
|
108
79
|
|
|
109
|
-
|
|
110
|
-
- **Title**: Login Test
|
|
111
|
-
- **Steps**:
|
|
112
|
-
1. Open the login page.
|
|
113
|
-
2. Enter valid credentials.
|
|
114
|
-
3. Click the "Log In" button.
|
|
115
|
-
- **Expected Result**: The dashboard is displayed.
|
|
80
|
+
When using the `--save` command, TestDriver appends any generated commands to the test file.
|
|
116
81
|
|
|
117
|
-
|
|
118
|
-
Each step becomes a `prompt`, and the expected result can be added as an assertion.
|
|
82
|
+
So as your test run, TestDriver will append successful commands to the yaml file and save it.
|
|
119
83
|
|
|
120
|
-
|
|
121
|
-
version:
|
|
84
|
+
```yaml
|
|
85
|
+
version: 5.3.11
|
|
86
|
+
session: 6801430b5f2c252a8f4bed60
|
|
122
87
|
steps:
|
|
123
|
-
- prompt:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
88
|
+
- prompt: Focus the browser window.
|
|
89
|
+
commands:
|
|
90
|
+
- command: focus-application
|
|
91
|
+
name: Google Chrome
|
|
92
|
+
- command: hover-text
|
|
93
|
+
text: Username
|
|
94
|
+
description: username input label in the login form
|
|
95
|
+
action: click
|
|
96
|
+
- prompt: Fill in the "Password" field with "secret_password".
|
|
97
|
+
commands:
|
|
98
|
+
- command: hover-text
|
|
99
|
+
text: Password
|
|
100
|
+
description: password input label in the login form
|
|
101
|
+
action: click
|
|
102
|
+
- command: type
|
|
103
|
+
text: secret_password
|
|
104
|
+
- command: hover-text
|
|
105
|
+
text: Password
|
|
106
|
+
description: password input field in the login form
|
|
107
|
+
action: click
|
|
128
108
|
```
|
|
129
109
|
|
|
130
|
-
|
|
131
|
-
A script can fetch test cases from TestRail, extract the steps and expected results, and generate YAML files.
|
|
110
|
+
Now the next time you run the test, TestDriver will use the commands instead of the prompt!
|
|
132
111
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
### Workflow Overview
|
|
138
|
-
TestDriver.ai can autonomously generate tests by exploring the UI and mapping workflows. This is particularly useful for:
|
|
139
|
-
- Discovering untested paths.
|
|
140
|
-
- Validating dynamic or complex UIs.
|
|
141
|
-
- Generating tests for new features without requiring manual input.
|
|
142
|
-
|
|
143
|
-
### How It Works:
|
|
144
|
-
1. **Recursive UI Mapping**: The AI navigates through the application, identifying clickable elements, input fields, and other interactive components.
|
|
145
|
-
2. **Test Generation**: The AI generates test cases based on the discovered workflows, including actions like clicking buttons, filling forms, and verifying outcomes.
|
|
146
|
-
3. **Self-Healing**: If the UI changes, the AI adapts the tests to match the new structure.
|
|
147
|
-
|
|
148
|
-
### Example AI-Generated Test:
|
|
149
|
-
For a login page, the AI might generate the following test:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
### Benefits:
|
|
153
|
-
- **No Manual Input Required**: The AI generates tests automatically.
|
|
154
|
-
- **Comprehensive Coverage**: The AI explores all possible paths, ensuring thorough testing.
|
|
155
|
-
- **Dynamic Adaptation**: Tests are updated automatically when the UI changes.
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## Summary of Test Generation Methods
|
|
160
|
-
|
|
161
|
-
| **Source** | **Description** | **Automation** |
|
|
162
|
-
|---------------------|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
|
|
163
|
-
| **CSV Files** | Convert rows into YAML test files. | Use a script to parse the CSV and generate YAML. |
|
|
164
|
-
| **Jira Tickets** | Extract user stories or acceptance criteria. | Use the Jira API to fetch tickets and generate YAML. |
|
|
165
|
-
| **Gherkin Scenarios** | Map `Given`, `When`, `Then` steps to YAML prompts. | Use a script to parse Gherkin files and generate YAML. |
|
|
166
|
-
| **TestRail** | Fetch test cases and steps from TestRail. | Use the TestRail API to extract test cases and generate YAML. |
|
|
167
|
-
| **AI-Driven Testing** | Automatically generate tests by exploring the UI and mapping workflows. | Let TestDriver.ai autonomously generate and adapt tests. |
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
## Best Practices
|
|
172
|
-
|
|
173
|
-
1. **Automate Test Generation**: Use scripts to streamline the conversion of test cases from various sources into YAML files.
|
|
174
|
-
2. **Leverage AI for Coverage**: Use TestDriver.ai's AI-driven exploratory testing to discover untested paths and validate dynamic UIs.
|
|
175
|
-
3. **Organize Test Files**: Store generated YAML files in a structured directory (e.g., `testdriver/`) for easy management.
|
|
176
|
-
4. **Review Generated Tests**: Manually review the generated tests to ensure they align with your testing requirements.
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
By combining structured test case imports (from CSV, Jira, Gherkin, and TestRail) with AI-driven exploratory testing, TestDriver.ai provides a comprehensive solution for generating and maintaining high-quality test suites.
|
|
112
|
+
```bash
|
|
113
|
+
testdriverai run testdriver/generate/test-error-user-login.yaml
|
|
114
|
+
```
|
|
@@ -120,7 +120,7 @@ When this workflow runs:
|
|
|
120
120
|
|
|
121
121
|
1. **Organize Test Files**: Use a consistent naming convention for test files to simplify management.
|
|
122
122
|
2. **Monitor Test Results**: Review the GitHub Actions dashboard to identify and debug failing tests.
|
|
123
|
-
3. **Optimize Test Files**: Ensure each test file is self-contained and
|
|
123
|
+
3. **Optimize Test Files**: Ensure each test file is self-contained and doesn't depend on the execution of other tests.
|
|
124
124
|
4. **Use Fail-Fast Judiciously**: Enable `fail-fast: true` only if you want to stop all tests when one fails.
|
|
125
125
|
|
|
126
126
|
---
|
|
@@ -32,7 +32,7 @@ steps:
|
|
|
32
32
|
This allows TestDriver locates the target for `hover-text` based on its context and description. The agent will search for elements: in the following order.
|
|
33
33
|
|
|
34
34
|
- `text` - exact element to match
|
|
35
|
-
- `description` - a description of the element given the exact text
|
|
35
|
+
- `description` - a description of the element given the exact text isn't found, or there are multiple matches
|
|
36
36
|
- `prompt` - a high level prompt used to regenerate the test if no match is found
|
|
37
37
|
|
|
38
38
|
### What Happens When "Sign Up" Changes to "Register"?
|
|
@@ -5,51 +5,111 @@ description: "Generate test plans and integrate them into your testing workflow.
|
|
|
5
5
|
icon: "steering-wheel"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Writing tests can be a tedious and time-consuming task. TestDriver.ai can generate tests just by exploring your app! This guide will show you how to generate tests using TestDriver.ai.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
# Launch TestDriver in Interactive Mode
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Launch `testdriverai` in interactive mode with the following command:
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
4. **Create PRs for Test Results**: Automatically generate PRs for test results, allowing teams to review and merge updates.
|
|
14
|
+
```bash
|
|
15
|
+
testdriverai
|
|
16
|
+
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
TestDriver will boot up.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
```bash
|
|
21
|
+
❯ testdriverai
|
|
22
|
+
Howdy! I'm TestDriver v5.3.11
|
|
23
|
+
```
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
Ensure your website or app is visible on your test runner's display.
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
2. Run the following command to start TestDriver.ai locally:
|
|
27
|
+
Then, run the `generate` command.
|
|
27
28
|
|
|
29
|
+
```bash
|
|
30
|
+
/generate web 10
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This will generate 10 tests within the `testdriver/generate` directory. You can change the number of tests generated by changing the number after `10`. The generated tests will be in the form of a `.js` file, and you can run them using your test runner of choice.
|
|
28
34
|
|
|
29
35
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
> /generate web 5
|
|
37
|
+
|
|
38
|
+
thinking...
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Now your directory structure will look like this:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
testdriver
|
|
45
|
+
├── generate
|
|
46
|
+
│ ├── test-error-user-login.yaml
|
|
47
|
+
│ ├── test-locked-out-user-login.yaml
|
|
48
|
+
│ ├── test-navigation-to-shop-page.yaml
|
|
49
|
+
│ ├── test-problem-user-login.yaml
|
|
50
|
+
│ └── test-standard-user-login.yaml
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Notice that each test file has no commands! It's only a list of prompts. This is similar to an exploratory test.
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
version: 5.3.11
|
|
57
|
+
steps:
|
|
58
|
+
- prompt: Fill in the "Username" field with "error_user".
|
|
59
|
+
- prompt: Fill in the "Password" field with "secret_password".
|
|
60
|
+
- prompt: Click the "Sign in" button.
|
|
61
|
+
- prompt: Assert that there are issues during checkout and an error is displayed.
|
|
32
62
|
```
|
|
33
63
|
|
|
34
|
-
|
|
64
|
+
# Generate Regression Tests from Exploratory Tests
|
|
35
65
|
|
|
36
|
-
|
|
66
|
+
Now it's time to generate the regression test.
|
|
67
|
+
|
|
68
|
+
Run the tests with the `run` command and use the `--save` parameter:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
testdriverai run testdriver/generate/test-error-user-login.yaml --save
|
|
72
|
+
```
|
|
37
73
|
|
|
38
|
-
|
|
74
|
+
When a test has no `commands`, TestDriver falls back to the `prompt`.
|
|
39
75
|
|
|
40
76
|
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
│ ├── test_1.yml
|
|
44
|
-
│ ├── test_2.yml
|
|
45
|
-
│ ├── test_3.yml
|
|
77
|
+
> Fill in the "Username" field with "error_user".
|
|
78
|
+
No commands found, running exploratory
|
|
46
79
|
```
|
|
47
|
-
### Run the test files
|
|
48
80
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
When using the `--save` command, TestDriver appends any generated commands to the test file.
|
|
82
|
+
|
|
83
|
+
So as your test run, TestDriver will append successful commands to the yaml file and save it.
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
version: 5.3.11
|
|
87
|
+
session: 6801430b5f2c252a8f4bed60
|
|
88
|
+
steps:
|
|
89
|
+
- prompt: Focus the browser window.
|
|
90
|
+
commands:
|
|
91
|
+
- command: focus-application
|
|
92
|
+
name: Google Chrome
|
|
93
|
+
- command: hover-text
|
|
94
|
+
text: Username
|
|
95
|
+
description: username input label in the login form
|
|
96
|
+
action: click
|
|
97
|
+
- prompt: Fill in the "Password" field with "secret_password".
|
|
98
|
+
commands:
|
|
99
|
+
- command: hover-text
|
|
100
|
+
text: Password
|
|
101
|
+
description: password input label in the login form
|
|
102
|
+
action: click
|
|
103
|
+
- command: type
|
|
104
|
+
text: secret_password
|
|
105
|
+
- command: hover-text
|
|
106
|
+
text: Password
|
|
107
|
+
description: password input field in the login form
|
|
108
|
+
action: click
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Now the next time you run the test, TestDriver will use the commands instead of the prompt!
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
testdriverai run testdriver/generate/test-error-user-login.yaml
|
|
115
|
+
```
|
|
@@ -28,7 +28,7 @@ The TestDriver.ai VSCode extension is available for download on our GitHub relea
|
|
|
28
28
|
|
|
29
29
|
# Try the Walkthrough
|
|
30
30
|
|
|
31
|
-
The extension should launch a walkthrough. If it
|
|
31
|
+
The extension should launch a walkthrough. If it doesn't, you can manually start it by running the command `TestDriver: Start Setup Walkthrough` from the Command Palette (`Ctrl+Shift+P`).
|
|
32
32
|
|
|
33
33
|

|
|
34
34
|
|
|
@@ -13,7 +13,7 @@ Assertions in TestDriver.ai allow you to validate that your application behaves
|
|
|
13
13
|
|
|
14
14
|
## What Are Assertions?
|
|
15
15
|
|
|
16
|
-
Assertions are checks that validate whether a specific condition is true. If the condition
|
|
16
|
+
Assertions are checks that validate whether a specific condition is true. If the condition isn't met, the test will fail, providing feedback on what went wrong.
|
|
17
17
|
|
|
18
18
|
### Types of Assertions in TestDriver.ai:
|
|
19
19
|
1. **Text Assertions**: Verify that specific text is visible on the screen.
|
|
@@ -12,13 +12,11 @@ This guide explains how to handle **authentication workflows** in **TestDriver.a
|
|
|
12
12
|
## How Authentication Works in TestDriver.ai
|
|
13
13
|
|
|
14
14
|
1. **Store Credentials Securely**:
|
|
15
|
-
|
|
15
|
+
- Use GitHub Secrets to store sensitive information like usernames, passwords, or API keys.
|
|
16
16
|
2. **Pass Credentials to the Workflow**:
|
|
17
|
-
|
|
17
|
+
- Supply credentials as environment variables or directly in the workflow.
|
|
18
18
|
3. **Use Credentials in Tests**:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
---
|
|
19
|
+
- Dynamically reference credentials in the `prerun` script or test files to perform authentication steps.
|
|
22
20
|
|
|
23
21
|
## Step 1: Store Credentials in GitHub Secrets
|
|
24
22
|
|
|
@@ -29,8 +27,6 @@ This guide explains how to handle **authentication workflows** in **TestDriver.a
|
|
|
29
27
|
- **`TESTDRIVER_API_KEY`**: Your TestDriver.ai API key.
|
|
30
28
|
- **`WEBSITE_URL`**: The URL of the website to test.
|
|
31
29
|
|
|
32
|
-
---
|
|
33
|
-
|
|
34
30
|
## Step 2: Pass Credentials to the Workflow
|
|
35
31
|
|
|
36
32
|
Secrets are passed to the GitHub Action using the `secrets` context. They can be supplied as:
|
|
@@ -78,13 +74,8 @@ jobs:
|
|
|
78
74
|
TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
|
|
79
75
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
80
76
|
FORCE_COLOR: "3"
|
|
81
|
-
|
|
82
|
-
|
|
83
77
|
```
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
79
|
## Step 3: Use Credentials in Test Files
|
|
89
80
|
|
|
90
81
|
Secrets can be referenced in the test file using placeholders (e.g., `${TD_USERNAME}` and `${TD_PASSWORD}`).
|
|
@@ -114,37 +105,30 @@ steps:
|
|
|
114
105
|
action: click
|
|
115
106
|
- command: assert
|
|
116
107
|
expect: The dashboard is displayed
|
|
117
|
-
|
|
118
|
-
|
|
119
108
|
```
|
|
120
109
|
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
110
|
## How It Works Together
|
|
125
111
|
|
|
126
112
|
1. **Secrets in the Workflow**:
|
|
127
|
-
|
|
113
|
+
- Secrets like `TD_USERNAME` and `TD_PASSWORD` are passed as environment variables to the TestDriver.ai action.
|
|
128
114
|
|
|
129
115
|
2. **Secrets in the `prerun` Script**:
|
|
130
|
-
|
|
116
|
+
- The `WEBSITE_URL` secret is used to launch the browser with the correct URL.
|
|
131
117
|
|
|
132
118
|
3. **Secrets in the Test File**:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
---
|
|
119
|
+
- The test file dynamically references the secrets to fill in login credentials during the test.
|
|
136
120
|
|
|
137
121
|
## Benefits of Using Authentication in TestDriver.ai
|
|
138
122
|
|
|
139
123
|
1. **Secure Handling of Credentials**:
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
- Secrets are encrypted and not exposed in logs.
|
|
125
|
+
- Even if printed, they appear as `***`.
|
|
142
126
|
|
|
143
127
|
2. **Dynamic Testing**:
|
|
144
|
-
|
|
128
|
+
- Easily switch between different environments (e.g., staging, production) by updating the secrets.
|
|
145
129
|
|
|
146
130
|
3. **Reusability**:
|
|
147
|
-
|
|
131
|
+
- Use the same workflow and test files across multiple repositories or environments.
|
|
148
132
|
|
|
149
133
|
---
|
|
150
134
|
|