Setting up environment variables for running xplat cli tests
Launch cmd console as admin at your test-directory/azure-xplat-cli, at the cmd console, run the following for environment setup:
set AZURE_GITHUB_PASSWORD=github password/access token
set AZURE_GITHUB_REPOSITORY=username/reponame
set AZURE_GITHUB_USERNAME=github_username
set AZURE_GIT_USERNAME=git_username
set AZURE_ARM_TEST_STORAGEACCOUNT=storage_account_name_created_in_the_subscription
set AZURE_ARM_TEST_LOCATION=South Central US
set AZURE_STORAGE_TEST_LOCATION=West US
set AZURE_STORAGE_ACCESS_KEY=access-key_of_the_storage_account
set AZURE_STORAGE_ACCOUNT=storage_account_name_created_in_the_subscription
set AZURE_SITE_TEST_LOCATION=West US
set AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=storage_account;AccountKey=access_key
set AZURE_SCM_SITE_SUFFIX=.scm.azurewebsites.net
set AZURE_AD_TEST_PASSWORD=your_password
Note: Not all tests require all these environment variables, and if a required one is not set the test will fail and tell you which ones need to be set.
To run the tests against Live environment set the following environment variable
set NOCK_OFF=true
To run the tests mocked unset the following environment variable, if it is previously set
set NOCK_OFF=
To record the live HTTP traffic, so as to run mocks later set the following environment variable
set AZURE_NOCK_RECORD=true
The recordings will get saved in azure-xplat-cli/test/recordings directory
set AZURE_COMMUNITY_IMAGE_ID=vmdepot-40432-1-1 (Select any Image ID from deployment script of any image selected from https://vmdepot.msopentech.com)
set AZURE_STORAGE_ACCESS_KEY=storage account access key
set AZURE_STORAGE_ACCOUNT=storage account name
set BLOB_SOURCE_PATH=path to the disk in a blob
set SSHCERT=path to the pem file
If you plan on adding some tests / features and do not need to regenerate the full set of test recordings, you can open the file: tests/testlist.txt and comment out the tests you do not wish to run during the recording process.
To do so, use a leading # character. i.e.:
# commands/cli.cloudservice-tests.js
# commands/cli.deployment-tests.js
commands/cli.site-tests.js
# commands/cli.site.appsetting-tests
In the above example only the cli.site-tests.js tests would be run.