Co-authored-by: Mary Gao <yanmeigao1210@gmail.com>
This commit is contained in:
kazrael2119 2023-07-26 17:22:50 +08:00 коммит произвёл GitHub
Родитель c527c7555c
Коммит 3621431550
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 8 добавлений и 18 удалений

Просмотреть файл

@ -22,13 +22,10 @@ This page is to help you write and run tests quickly for Javascript Codegen SDK
The Azure SDK test framework uses the [`test-recorder`](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/test-utils/recorder/README.md) library, which in turn rests upon on a HTTP recording system ([testproxy](https://github.com/Azure/azure-sdk-tools/tree/main/tools/test-proxy)) that enables tests dependent on network interaction to be run offline.
At the moment, tests in our repo depend on one of the two different versions of the recorder tool (`@azure-tools/test-recorder`) - `1.a.b` and `2.x.y`. And this quickstart is based on 2.x.y version.
Please notice that this quickstart is based on 3.x.y version of recorder tool (`@azure-tools/test-recorder`).
# Prerequisites
- Docker
- [Docker](https://www.docker.com/get-started/) is required, as the [test proxy server](https://github.com/Azure/azure-sdk-tools/tree/main/tools/test-proxy) is running in a container during testing
- When running the tests, ensure the Docker daemon is running and you have permission to use it.
- Rush 5.x
- Install/update Rush globally via `npm install -g @microsoft/rush`
- Any of [the LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
@ -185,10 +182,11 @@ const envSetupForPlayback: Record<string, string> = {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
AZURE_SUBSCRIPTION_ID: "azure_subscription_id"
};
const recorderEnvSetup: RecorderStartOptions = {
envSetupForPlaayback,
envSetupForPlayback,
};
//...
@ -280,7 +278,7 @@ const envSetupForPlayback: Record<string, string> = {
};
const recorderEnvSetup: RecorderStartOptions = {
envSetupForPlaayback,
envSetupForPlayback,
};
/**

Просмотреть файл

@ -147,16 +147,12 @@ In order to release your RLC library, we need to add some tests for it to make s
See the [JavaScript Codegen Quick Start for Test](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Quickstart-on-how-to-write-tests.md) for information on how to write and run tests for the JavaScript SDK.
1. **Prerequisites**
To record and playback the tests, [Docker](https://www.docker.com/) is required when we run the test, as the [test proxy server](https://github.com/Azure/azure-sdk-tools/tree/main/tools/test-proxy) is run in a container during testing. When running the tests, ensure the Docker daemon is running and you have permission to use it.
2. **Write the test**
1. **Write the test**
You could follow the [basic RLC test interaction and recording example](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Quickstart-on-how-to-write-tests.md#example-1-basic-rlc-test-interaction-and-recording-for-azure-data-plane-service) to write your test step by step. Also you could refer [the test of MapsRouteClient](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-route-rest/test/public) for more cases.
3. **Run the test**
2. **Run the test**
Now, you can run the test like this. If you are the first time to run test, you need to set the environment variable `TEST_MODE` to `record`. This will generate recordings for your test they could be used in `playback` mode.
On Linux, you could use `export` to set env variable:
```shell

Просмотреть файл

@ -117,15 +117,11 @@ In order to release it, we need to add some tests for it to make sure we are del
See the [Javascript Codegen Quick Start for Test](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Quickstart-on-how-to-write-tests.md) for information on how to write and run tests for the Javascript SDK.
1. **Prerequisites**
To record and playback the tests, [Docker](https://www.docker.com/) is required when we run the test, as the [test proxy server](https://github.com/Azure/azure-sdk-tools/tree/main/tools/test-proxy) is ran in a container during testing. When running the tests, ensure the Docker daemon is running and you have permission to use it.
2. **Write the test**
1. **Write the test**
You could follow the [basic RLC test interaction and recording example](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Quickstart-on-how-to-write-tests.md#example-1-basic-rlc-test-interaction-and-recording-for-azure-data-plane-service) to write your test step by step. Also you could refer [the test of MapsRouteClient](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/maps/maps-route-rest/test/public) for more cases.
3. **Run the test**
2. **Run the test**
Now, you can run the test like this. If you are the first time to run test, you need to set the environment variable `TEST_MODE` to `record`. This will generate recordings for your test they could be used in `playback` mode.
On Linux, you could use `export` to set env variable:
```shell