Skip to content

Golden Testing Commands

Harsha Nalluru edited this page Nov 28, 2024 · 6 revisions

Useful Commands while Testing your packages

If you're not familiar with the recorder refer to recorder-readme.

If you're looking to migrate your existing package from recorder v1 to v3, refer to migrate-v1-to-v3.

If you're looking to be onboarded to the asset-sync workflow to push out the test recordings to Azure/azure-sdk-assets repository, refer to asset-sync-migration.

rush Commands

script name What does it do?
rush update Updates dependencies
rush build -t . Expected to be run from inside your package(sdk/service-name/package-name). Builds the whole dependency tree.

rushx Commands - to run the tests

script name command(usually)
rushx unit-test:browser dev-tool run test:browser
rushx unit-test:node dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'
rushx integration-test:browser dev-tool run test:browser
rushx integration-test:node dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'

After migrating to asset-sync

Expects that you have dev-tool among your devDependencies. Expects that you have powershell installed.

script command What does it do?
npx dev-tool test-proxy init [Only once per package] Generates the assets.json with an empty tag. After init, run test commands such as rushx test:node to generate test recordings and push them.
npx dev-tool test-proxy migrate --initial-push [Only once per package] To migrate the test recordings to the assets repo for the first time. Also generates assets.json
npx dev-tool test-proxy push To push the test recordings to the assets repo.
npx dev-tool test-proxy reset Reverts the local changes to recordings and resets to what is currently checked in to the assets repo. This is a destructive operation.
npx dev-tool test-proxy restore Pulls the recordings from the assets repo that are referenced in your assets.json. Typically this will be done automatically when you first run tests in playback if the recordings haven't been downloaded already. But you can run this command in advance if you'd like to download them earlier, for example for offline work.

Debug logs from test-proxy tool

script command What does it do?
dev-tool run test:vitest --test-proxy-debug Provides helpful test-proxy debug logs that include sanitization modifications for both the central sanitizers and the user-specified ones.