|
1 | 1 | # Test case recorder
|
2 | 2 |
|
3 |
| -## Record new tests |
4 |
| -1. Add voice command |
5 |
| - - `cursorless record: user.vscode("cursorless.recordTestCase")` |
6 |
| - - We don't want to commit this so add it to your own repository. |
| 3 | +We use an automated test case recorder to generate test cases. To use it, you |
| 4 | +set up a file the way you'd like (usually a minimal file containing something |
| 5 | +like `hello world`), positioning your cursor where you want, tell cursorless to |
| 6 | +start recording, and then issue one or more cursorless commands. It works by |
| 7 | +recording the initial state of the file including cursor position(s), the |
| 8 | +command run, and the final state, all in the form of a yaml document. See |
| 9 | +[existing test cases](../src/test/suite/fixtures/recorded) for example outputs. |
| 10 | + |
| 11 | +## Initial setup |
| 12 | + |
| 13 | +1. Add a voice command for recording to your personal talon files: |
| 14 | + - `cursorless record: user.vscode("cursorless.recordTestCase")` |
| 15 | + - We don't want to commit this so add it to your own repository. |
| 16 | + |
| 17 | +## Recording new tests |
| 18 | + |
7 | 19 | 1. Start debugging (F5)
|
8 |
| -1. `"cursorless record"` |
9 |
| - - List of target directories is shown |
| 20 | +1. Create a minimal file to use for recording tests. And position your cursor |
| 21 | + where you'd like. Check out the `initialState.documentContents` field of |
| 22 | + [existing test cases](../src/test/suite/fixtures/recorded) for examples. |
| 23 | +1. Issue the `"cursorless record"` command |
| 24 | + - List of target directories is shown. All test cases will be put into the |
| 25 | + given subdirectory of `src/test/suite/fixtures/recorded` |
10 | 26 | 1. Select existing directory or create new one
|
11 |
| - - Select `Create new folder` |
12 |
| - - Use `/` to create subdirectories. |
| 27 | + - Select `Create new folder` |
| 28 | + - If the new directory name contains any `/`, it will create nested |
| 29 | + subdirectories. |
13 | 30 | 1. `Recording test cases for following commands` is shown
|
14 | 31 | 1. Issue any cursorless voice command
|
15 |
| - - `"take air"` |
| 32 | + - `"take air"` |
16 | 33 | 1. `Cursorless test case saved` is shown
|
17 |
| - - File created on disk using spoken words as file name |
18 |
| -1. Repeat as many voice commands as you want recorded |
19 |
| -1. `"cursorless record"` |
20 |
| - - `Stopped recording test cases` is shown |
21 |
| - - You can also just stop the debugger or close the debug window |
| 34 | + - File created on disk using spoken words as file name |
| 35 | +1. Repeat as many cursorless voice commands as you want recorded. Each command |
| 36 | + you |
| 37 | + issue will generate a test case in the form of a yaml file. |
| 38 | +1. Issue `"cursorless record"` command again to stop recording |
| 39 | + - `Stopped recording test cases` is shown |
| 40 | + - You can also just stop the debugger or close the debug window |
22 | 41 |
|
23 | 42 | ## Run recorded tests
|
24 |
| -Recorded tests are run with the normal test and can be run in vscode or via yarn in terminal. |
| 43 | + |
| 44 | +Recorded tests will automatically be picked up and run with the normal tests, |
| 45 | +and can be run in vscode or via yarn in terminal. |
0 commit comments