Skip to content

Commit

Permalink
update docs (Azure#26617)
Browse files Browse the repository at this point in the history
Co-authored-by: Mary Gao <[email protected]>
  • Loading branch information
kazrael2119 and MaryGao authored Jul 26, 2023
1 parent c527c75 commit 3621431
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
10 changes: 4 additions & 6 deletions documentation/Quickstart-on-how-to-write-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
};

//...
Expand Down Expand Up @@ -280,7 +278,7 @@ const envSetupForPlayback: Record<string, string> = {
};

const recorderEnvSetup: RecorderStartOptions = {
envSetupForPlaayback,
envSetupForPlayback,
};

/**
Expand Down
8 changes: 2 additions & 6 deletions documentation/RLC-Swagger-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions documentation/RLC-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3621431

Please sign in to comment.