vscode/test/smoke/README.md

61 lines
2.7 KiB
Markdown
Raw Normal View History

2017-09-08 17:04:52 +00:00
# VS Code Automated Smoke Testing
2017-06-30 13:32:45 +00:00
2017-09-08 17:04:52 +00:00
## Framework
2017-09-08 18:28:03 +00:00
* Smoke tests are written using the [Spectron](https://electron.atom.io/spectron/) and [Mocha](https://mochajs.org/) frameworks.
* Spectron is used to control the lifecycle of VS Code and also to query the DOM elements of VS Code renderer window using the [WebriverIO](http://webdriver.io/) API that is wrapped in Spectron API.
* Mocha is used to launch the smoke tests.
2017-09-08 17:04:52 +00:00
## Code Organization
* All smoke test code is present under `/test/smoke/` folder. Code is organized into indvidual areas. Each area contains a facade to to access it functionality and a test file to test it. For e.g. `debug` area has `debug.ts` facade class that provides utility methods to access debug functionalities. It also has `debug.test.ts` that tests the debug functionalities.
* `application.ts` provides APIs to start and stop the VS Code application. It also provides access to various utility APIs like
* client
* webclient
* screenCapturer
* workbench
* `client.ts` class wraps WebDriverIO APIs and provides enhanced APIs for accessing DOM elements. For e.g. it has methods like `waitForElement(selector, accept)` that will query the DOM with the given selector and waits until the element is found or time out after configured time (`5s`).
* `screenCapturer.ts` allows you capture the screenshots. Capturing is done only if argument `--screenshots` is passed while launching smoke tests. When run out of sources, screenshots are captured under `screenshots` folder in the parent directory of vscode workspace.
* `workbench.ts` provides utlities to access workbench functionality and also access to other functionality areas like `scm`, `debug`, `editor`. **Note**: All areas should be able to be accessible from workbench either directly or through area traversal.
### Adding new area and tests
To contribute a new smoke test area, add `${area}` folder under `./areas/`. All tests and facades related to this area should go under this folder. Newly added tests should be listed in `main.ts` as imports so that mocha can pick and run them.
## Running "Out of Sources"
2017-09-04 09:32:41 +00:00
```
2017-09-08 17:04:52 +00:00
npm run smoketest
2017-09-04 09:32:41 +00:00
```
2017-05-22 11:56:23 +00:00
2017-09-08 17:04:52 +00:00
## Running Insiders
```
npm run smoketest -- --build "path/to/code-insiders"
```
2017-09-04 09:32:41 +00:00
2017-09-08 17:04:52 +00:00
## Running Stable
2017-09-04 09:32:41 +00:00
```
2017-09-08 17:04:52 +00:00
npm run smoketest -- --build "path/to/code"
2017-09-04 09:32:41 +00:00
```
2017-06-30 14:21:34 +00:00
2017-09-08 17:04:52 +00:00
To run 'Data Migration' tests, specify the path of the version to be migrated using `--stable` argument
2017-05-22 11:56:23 +00:00
2017-09-08 17:04:52 +00:00
```
npm run smoketest -- --build "path/to/code-insiders" --stable "path/to/code"
```
2017-06-01 13:50:23 +00:00
2017-09-08 17:04:52 +00:00
By default screenshots are not captured. To run tests with screenshots use the argument `--screenshots`
2017-06-01 13:50:23 +00:00
2017-09-08 17:04:52 +00:00
```
npm run smoketest -- --screenshots
```
2017-09-08 17:04:52 +00:00
To run a specific test suite use `-f ${suiteName}` argument
2017-06-01 13:50:23 +00:00
2017-09-08 17:04:52 +00:00
```
npm run smoketest -- -f Git
```
2017-05-22 11:56:23 +00:00
2017-06-01 13:50:23 +00:00
# Debugging
2017-09-04 09:32:41 +00:00
2017-09-08 17:04:52 +00:00
Update