Automated testing strategy and examples
The documented strategy and guide to writing tests are being committed into the repository. Here are the links:
- Automated testing strategy - https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/testing/docs/testing-strategy.md
- Writing tests - https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/testing/docs/writing-tests.md
This MR seems large but contains almost no production code changes. Most added lines are in package-lock.json
and in the new JSON fixtures mocking the API responses.
Test examples:
After you read the documents, you can see the following examples:
- unit test - git_remote_parser.test.js (original test made into unit test)
- integration test - tree_view.test.js
If I had more time, I would
- Write example integration test for command
- Create test helper that would spy on vscode commands in integration tests, maybe we'll have to create a mocked command registry
- Write example integration test for the status bar
- Write one unit test for the
webview
project - Create more examples of uni tests, even though those are the most straightforward.
Closes #199 (closed)