This extension is for running tests against specific features that require a connection to an actual server.
Unit tests that don't require this should be added as tests to the extensions or core directly.
Tests that require user interaction should be added to the smoke tests - see https://github.com/microsoft/azuredatastudio/blob/main/test/smoke/README.md for more information.
extensionInstallers
folder: VSIX packages of non-builtin extensions should be put here for the tests to run with, they will be installed upon startup of the tests.src/test
folder: This is where the test files for features should be added, name the file like this:feature.test.ts
e.g.objectExplorer.test.ts
When these tests are ran, Azure Data Studio will be launched using new temp folders for installed extensions and data so that your local dev environment won't be changed.
-
In the build pipeline: The integration test suite has been added to ADS windows pipeline to run the test and report the results, you can find the test results under the test tab.
-
Local environment:
-
Install and start Docker Desktop for your system
-
Install Azure CLI
-
Close all currently active VS Code windows
-
Open a terminal window/command line window
-
Run
az login
to login with your Microsoft AAD account. -
Navigate to this folder and then run
node setEnvironmentVariables.js
, there are different options, by default VS Code will be opened.- Terminal(Mac)/CMD(Windows):
node setEnvironmentVariables.js Terminal
- Git-Bash on Windows:
node setEnvironmentVariables.js BashWin
Note: Running the script may take some time, especially if it's the first time it's being run.
- Terminal(Mac)/CMD(Windows):
-
A new window will be opened based on your selection and the new window will have the required environment variables set.
-
In the new window navigate to the scripts folder and run sql-test-integration.[bat|sh]
These tests won't work locally on an M1 Mac.
-
- Set the debug target to
Attach to Extension Host
- Run the script to start the tests
- Wait for the Window to reload (it does this after installing and activating the extensions)
- Run the debug target - it should now attach to the Extension Host process and hit breakpoints set in the integration tests
Code coverage is enabled by default. After running the tests you can find the results in the coverage
folder at the root of this extension.
This code coverage covers extension code only - it will not instrument code from the core.