The test proxy is the standard recording/playback infrastructure for Azure SDK tests. It stores recordings in an external azure-sdk-assets repository, keeping them out of the main SDK repo.
The test proxy sits between the test client and the live Azure endpoint during recording, capturing HTTP requests and responses. During playback, it serves the recorded responses.
Key benefits:
- Repo size — recordings move out of the main repo to a dedicated assets repo
- Shared infrastructure — single recording format across all Azure SDK languages
- Performance testing — test proxy can serve as a local stub for benchmarks
Change your test base class from TestBase to TestProxyTestBase:
public abstract class MyServiceClientTestBase extends TestProxyTestBase {
// existing setup code ...
}Remove old recordings from src/test/resources/session-records/.
Set the test mode and run:
export AZURE_TEST_MODE=RECORD
mvn test -f sdk/<service>/<module>/pom.xmlNew recordings land in a git-excluded .assets/ folder at the repo root (not committed to the main repo).
Add sanitizers in your test base class — they must be registered only after the playback client or record policy is initialized. See TableClientTestBase for an example.
This is a one-time step per library. Skip if your library already has an assets.json.
- Library is already migrated to test proxy (Phase 1)
- Git ≥ 2.25.0
- PowerShell Core ≥ 7.0
- Global git config with
user.nameanduser.email - Membership in the
azure-sdk-writeGitHub group
-
From
sdk/<service>/<module>/, run the generation script:../../../eng/common/testproxy/onboarding/generate-assets-json.ps1 -InitialPush
This:
- Creates
assets.jsonin the library directory - Pushes the recordings to the azure-sdk-assets repo
- Deletes the recording files from the local repo
- Creates
-
Verify with
git status:- A new
assets.jsonshould appear in your library directory - Recording files appear as deleted
- A new
-
Commit both changes to the language repo.
export AZURE_TEST_MODE=PLAYBACK # or omit; PLAYBACK is the default
mvn test -f sdk/<service>/<module>/pom.xmlThe test proxy automatically checks out the correct recording tag.
To find where recordings are stored locally:
test-proxy config locate -a ./assets.jsonexport AZURE_TEST_MODE=RECORD
mvn test -f sdk/<service>/<module>/pom.xml
# Push updated recordings to the assets repo
test-proxy push -a sdk/<service>/<module>/assets.jsonAfter pushing, assets.json is updated with a new tag. Include this assets.json change in your PR.
# Check out recordings for a library
test-proxy restore -a sdk/<service>/<module>/assets.json
# Push updated recordings
test-proxy push -a sdk/<service>/<module>/assets.json
# Show where recordings are stored locally
test-proxy config locate -a sdk/<service>/<module>/assets.json