diff --git a/extensions/integration-tests/readme.md b/extensions/integration-tests/readme.md index 9299a6812c..675867815d 100644 --- a/extensions/integration-tests/readme.md +++ b/extensions/integration-tests/readme.md @@ -7,7 +7,10 @@ The integration-tests suite is based on the extension testing feature provided b * extensionInstallers folder: Copy the VISX installers for the extensions we would like to run the tests with. * src folder: This is where the test file for features should be added, name the file like this: feature.test.ts. e.g. objectExplorer.test.ts -ADS will be launched using new temp folders: extension folder and data folder so that your local dev environment won't be changed. +## UI automation testing +The UI automation test cases should be added under $root/test/smoke/src/sql folder. Each feature should create its own folder and add 2 files, one for accessing the feature and the other for the test cases. For example: objectExplorer.ts and objectExplorer.test.ts. only tested on Windows for now. + +For both Smoke test and Integration test, ADS will be launched using new temp folders: extension folder and data folder so that your local dev environment won't be changed. ## How to run the test 1. In the build pipeline: @@ -20,15 +23,8 @@ The integration test suite has been added to ADS windows pipeline to run the tes 2. Git-Bash on Windows: node setEnvironmentVariables.js BashWin 3. Follow the instructions in the window: you will be prompted to login to azure portal. 4. A new window will be opened based on your selection and the new window will have the required environment variables set. - 5. In the new window navigate to the scripts folder and run sql-test-integration.bat or sql-test-integration.sh based on your environment. - -## UI automation testing -The UI automation test cases should be added under $root/test/smoke/src/sql folder. Each feature should create its own folder and add 2 files, one for accessing the feature and the other for the test cases. For example: objectExplorer.ts and objectExplorer.test.ts. only tested on Windows for now. - -## How to run the test -1. In the build pipeline: -The smoke 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. - -2. Local environment -navigate to test/smoke folder and run: node test/index.js -You can also run UI automation from VSCode by selecting the launch option: Launch Smoke Test. + 5. Run the Test: + 1. For Integration Test: in the new window navigate to the scripts folder and run sql-test-integration.bat or sql-test-integration.sh based on your environment. + 2. Smoke Test can be launched in 2 ways: + 1. In the new window navigate to the test/smoke folder and run: node smoke/index.js + 2. Or, In a VSCode window opened by step above, open AzureDataStudio folder and then select the 'Launch Smoke Test' option. diff --git a/extensions/integration-tests/src/notebook.test.ts b/extensions/integration-tests/src/notebook.test.ts index 314b73a06a..9a5224616d 100644 --- a/extensions/integration-tests/src/notebook.test.ts +++ b/extensions/integration-tests/src/notebook.test.ts @@ -11,8 +11,8 @@ import * as azdata from 'azdata'; import * as vscode from 'vscode'; import { context } from './testContext'; import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata, getFileName, pySparkNotebookContent, pySpark3KernelMetadata, pythonKernelMetadata, sqlNotebookMultipleCellsContent } from './notebook.util'; -import { getBdcServer } from './testConfig'; -import { connectToServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './utils'; +import { getBdcServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './testConfig'; +import { connectToServer } from './utils'; import * as fs from 'fs'; if (context.RunTest) { diff --git a/extensions/integration-tests/src/setup.test.ts b/extensions/integration-tests/src/setup.test.ts index b370c43aa7..930539d4c8 100644 --- a/extensions/integration-tests/src/setup.test.ts +++ b/extensions/integration-tests/src/setup.test.ts @@ -9,7 +9,7 @@ import 'mocha'; import * as vscode from 'vscode'; import { context } from './testContext'; import assert = require('assert'); -import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './utils'; +import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './testConfig'; assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined && getConfigValue(EnvironmentVariable_BDC_USERNAME) !== undefined && diff --git a/extensions/integration-tests/src/testConfig.ts b/extensions/integration-tests/src/testConfig.ts index 1faede0923..ed64d0217c 100644 --- a/extensions/integration-tests/src/testConfig.ts +++ b/extensions/integration-tests/src/testConfig.ts @@ -1,5 +1,3 @@ -import { getConfigValue, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD } from './utils'; - /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. @@ -20,6 +18,7 @@ interface ITestServerProfile { database: string; provider: ConnectionProvider; version: string; + engineType: EngineType; } interface INameDisplayNamePair { @@ -36,6 +35,12 @@ export enum ConnectionProvider { SQLServer } +export enum EngineType { + Standalone, + Azure, + BigDataCluster +} + var connectionProviderMapping = {}; var authenticationTypeMapping = {}; connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' }; @@ -43,6 +48,22 @@ connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displ authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' }; authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' }; +export function getConfigValue(name: string): string { + let configValue = process.env[name]; + return configValue ? configValue.toString() : ''; +} + +export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME'; +export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME'; +export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD'; +export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL'; +export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME'; +export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD'; +export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL'; +export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME'; +export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD'; +export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH'; + export class TestServerProfile { constructor(private _profile: ITestServerProfile) { } public get serverName(): string { return this._profile.serverName; } @@ -56,6 +77,7 @@ export class TestServerProfile { public get authenticationType(): AuthenticationType { return this._profile.authenticationType; } public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; } public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; } + public get engineType(): EngineType { return this._profile.engineType; } } var TestingServers: TestServerProfile[] = [ @@ -67,7 +89,8 @@ var TestingServers: TestServerProfile[] = [ authenticationType: AuthenticationType.SqlLogin, database: 'master', provider: ConnectionProvider.SQLServer, - version: '2017' + version: '2017', + engineType: EngineType.Standalone }), new TestServerProfile( { @@ -77,7 +100,8 @@ var TestingServers: TestServerProfile[] = [ authenticationType: AuthenticationType.SqlLogin, database: 'master', provider: ConnectionProvider.SQLServer, - version: '2012' + version: '2012', + engineType: EngineType.Azure }), new TestServerProfile( { @@ -87,7 +111,8 @@ var TestingServers: TestServerProfile[] = [ authenticationType: AuthenticationType.SqlLogin, database: 'master', provider: ConnectionProvider.SQLServer, - version: '2019' + version: '2019', + engineType: EngineType.BigDataCluster }) ]; @@ -100,24 +125,19 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair } } -export async function getDefaultTestingServer(): Promise { - let servers = await getTestingServers(); - return servers[0]; -} - export async function getAzureServer(): Promise { let servers = await getTestingServers(); - return servers.filter(s => s.version === '2012')[0]; + return servers.filter(s => s.engineType === EngineType.Azure)[0]; } export async function getStandaloneServer(): Promise { let servers = await getTestingServers(); - return servers.filter(s => s.version === '2017')[0]; + return servers.filter(s => s.version === '2017' && s.engineType === EngineType.Standalone)[0]; } export async function getBdcServer(): Promise { let servers = await getTestingServers(); - return servers.filter(s => s.version === '2019')[0]; + return servers.filter(s => s.version === '2019' && s.engineType === EngineType.BigDataCluster)[0]; } export async function getTestingServers(): Promise { diff --git a/extensions/integration-tests/src/utils.ts b/extensions/integration-tests/src/utils.ts index c8c5014856..190f4918e6 100644 --- a/extensions/integration-tests/src/utils.ts +++ b/extensions/integration-tests/src/utils.ts @@ -36,18 +36,3 @@ export async function connectToServer(server: TestServerProfile, timeout: number export async function ensureConnectionViewOpened() { await vscode.commands.executeCommand('dataExplorer.servers.focus'); } - -export function getConfigValue(name: string): string { - return process.env[name]; -} - -export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME'; -export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME'; -export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD'; -export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL'; -export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME'; -export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD'; -export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL'; -export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME'; -export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD'; -export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH'; diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts index 3c24d0e6d1..f586e880dc 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts @@ -61,6 +61,8 @@ class SelectListRenderer implements IListRenderer { @@ -12,7 +12,7 @@ export function setup() { const app = this.app as Application; await app.workbench.profiler.launchProfiler(); await app.workbench.connectionDialog.waitForConnectionDialog(); - await app.workbench.connectionDialog.connect(await getDefaultTestingServer()); + await app.workbench.connectionDialog.connect(await getStandaloneServer()); await app.workbench.profiler.waitForNewSessionDialogAndStart(); }); }); diff --git a/test/smoke/src/sql/testConfig.ts b/test/smoke/src/sql/testConfig.ts index 48ca5ed035..ed64d0217c 100644 --- a/test/smoke/src/sql/testConfig.ts +++ b/test/smoke/src/sql/testConfig.ts @@ -18,6 +18,7 @@ interface ITestServerProfile { database: string; provider: ConnectionProvider; version: string; + engineType: EngineType; } interface INameDisplayNamePair { @@ -34,6 +35,12 @@ export enum ConnectionProvider { SQLServer } +export enum EngineType { + Standalone, + Azure, + BigDataCluster +} + var connectionProviderMapping = {}; var authenticationTypeMapping = {}; connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' }; @@ -41,6 +48,22 @@ connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displ authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' }; authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' }; +export function getConfigValue(name: string): string { + let configValue = process.env[name]; + return configValue ? configValue.toString() : ''; +} + +export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME'; +export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME'; +export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD'; +export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL'; +export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME'; +export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD'; +export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL'; +export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME'; +export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD'; +export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH'; + export class TestServerProfile { constructor(private _profile: ITestServerProfile) { } public get serverName(): string { return this._profile.serverName; } @@ -54,18 +77,42 @@ export class TestServerProfile { public get authenticationType(): AuthenticationType { return this._profile.authenticationType; } public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; } public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; } + public get engineType(): EngineType { return this._profile.engineType; } } var TestingServers: TestServerProfile[] = [ new TestServerProfile( { - serverName: 'SQLTOOLS2017-3', - userName: '', - password: '', - authenticationType: AuthenticationType.Windows, + serverName: getConfigValue(EnvironmentVariable_STANDALONE_SERVER), + userName: getConfigValue(EnvironmentVariable_STANDALONE_USERNAME), + password: getConfigValue(EnvironmentVariable_STANDALONE_PASSWORD), + authenticationType: AuthenticationType.SqlLogin, database: 'master', provider: ConnectionProvider.SQLServer, - version: '2017' + version: '2017', + engineType: EngineType.Standalone + }), + new TestServerProfile( + { + serverName: getConfigValue(EnvironmentVariable_AZURE_SERVER), + userName: getConfigValue(EnvironmentVariable_AZURE_USERNAME), + password: getConfigValue(EnvironmentVariable_AZURE_PASSWORD), + authenticationType: AuthenticationType.SqlLogin, + database: 'master', + provider: ConnectionProvider.SQLServer, + version: '2012', + engineType: EngineType.Azure + }), + new TestServerProfile( + { + serverName: getConfigValue(EnvironmentVariable_BDC_SERVER), + userName: getConfigValue(EnvironmentVariable_BDC_USERNAME), + password: getConfigValue(EnvironmentVariable_BDC_PASSWORD), + authenticationType: AuthenticationType.SqlLogin, + database: 'master', + provider: ConnectionProvider.SQLServer, + version: '2019', + engineType: EngineType.BigDataCluster }) ]; @@ -78,9 +125,19 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair } } -export async function getDefaultTestingServer(): Promise { +export async function getAzureServer(): Promise { let servers = await getTestingServers(); - return servers[0]; + return servers.filter(s => s.engineType === EngineType.Azure)[0]; +} + +export async function getStandaloneServer(): Promise { + let servers = await getTestingServers(); + return servers.filter(s => s.version === '2017' && s.engineType === EngineType.Standalone)[0]; +} + +export async function getBdcServer(): Promise { + let servers = await getTestingServers(); + return servers.filter(s => s.version === '2019' && s.engineType === EngineType.BigDataCluster)[0]; } export async function getTestingServers(): Promise {