Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit bd5febe

Browse files
authored
Merge branch 'Azure:main' into main
2 parents 873fd5f + b55607c commit bd5febe

File tree

257 files changed

+34735
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+34735
-440
lines changed

.github/pull_request_assignment.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
reviewers:
115115
- ArcturusZhang
116116

117+
- rule:
118+
paths:
119+
- "specification/monitor/**"
120+
reviewers:
121+
- ArcturusZhang
122+
117123
- rule:
118124
paths:
119125
- "specification/authorization/**"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ warnings.txt
110110
!.vscode/launch.json
111111
!.vscode/extensions.json
112112

113+
# API Test outputs
114+
.apitest
115+
113116
*.js
114117
*.d.ts
115118
*.js.map
116-
*.d.ts.map
119+
*.d.ts.map

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Specification files and AutoRest configuration files in one RP folder are better
176176
## Next steps
177177
The next step in the process after a spec is completed is to generate SDKs and API reference documentation. If you're Microsoft employee, go to the [Azure SDK - Internal Wiki](https://aka.ms/jointhesdk) for more information.
178178

179-
External Contributors can read [Getting Started with Azure API Specifications](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/getting-started-with-azure-api-specifications.md).
179+
External Contributors can read [Getting Started with OpenAPI Specifications](https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/Getting%20started%20with%20OpenAPI%20specifications.md).
180180

181181
---
182182
_This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments._

documentation/api-scenario/how-to/QuickStart.md

Lines changed: 74 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,27 @@
55
https://opensource.org/licenses/MIT
66
-->
77

8-
# API test quick start
8+
# Quick start with API Scenario test
99

1010
## Install
1111

12-
`oav` is an open-source powerful tool for swagger validation, example generation, and API testing. GitHub: https://github.com/Azure/oav.
12+
`oav` is an open-source powerful tool for swagger validation, API Scenario testing, and examples generation. GitHub: https://github.com/Azure/oav.
1313

1414
```sh
15-
npm install -g oav@latest
15+
npm install -g oav
1616
```
1717

1818
### OAV Features
1919

20-
- Very easy to use and run.
21-
- Support postman collection format. Debug easily.
22-
- Request response validation. `oav` implement a powerful validation algorithm and help developer to detect service issue in the early phase.
23-
- Validation result report. After each run API scenario, developer will get a validation report which contains detect issue in api test.
20+
- Very easy to use and run. It supports running API Scenario with ARM Dogfood/Canary/Production environments, and local environment as well.
21+
- Support Postman collection format. Debug easily.
22+
- Traffic schema validation and Azure API guidelines validation. `oav` implements a powerful validation algorithm and help developer to detect service issue in the early phase.
23+
- Generating high quality Swagger examples from API test traffic.
24+
- Validation result report. After each run API scenario, developer will get a validation report which contains detected issue in API test.
2425
- Integrate everywhere. Easily integrate with azure-pipeline, cloud-test.
2526

27+
See `oav run -h` to find all available options.
28+
2629
## Create AAD app
2730

2831
To run API test, first please prepare an AAD app which is used for provisioning Azure resource. Please grant subscription contributor permission to this AAD app.
@@ -31,7 +34,7 @@ For how to create AAD app, please follow this doc https://docs.microsoft.com/en-
3134

3235
## Authoring steps
3336

34-
We will write API scenario file for SignalR service as an example.
37+
We will write API scenario file for AppConfiguration service as an example.
3538

3639
#### 1. Write your first API scenario file
3740

@@ -44,68 +47,105 @@ Now write your basic API scenario. For more detail about API scenario file forma
4447

4548
```yaml
4649
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/documentation/api-scenario/references/v1.2/schema.json
50+
scope: ResourceGroup
51+
variables:
52+
configStoreName:
53+
type: string
54+
prefix: configstor
4755

56+
scenarios:
57+
- scenario: quickStart
58+
description: Quick start with AppConfiguration ConfigurationStores
59+
steps:
60+
- step: Operations_CheckNameAvailability
61+
exampleFile: ../examples/CheckNameAvailable.json
62+
- step: ConfigurationStores_Create
63+
exampleFile: ../examples/ConfigurationStoresCreate.json
64+
- step: ConfigurationStores_Get
65+
exampleFile: ../examples/ConfigurationStoresGet.json
66+
```
67+
68+
or use operation based step if Swagger examples are not ready or you want to create more scenarios without writing Swagger examples.
69+
70+
```yaml
71+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/documentation/api-scenario/references/v1.2/schema.json
4872
scope: ResourceGroup
73+
variables:
74+
configStoreName:
75+
type: string
76+
prefix: configstor
77+
4978
scenarios:
5079
- scenario: quickStart
51-
description: Microsoft.SignalRService/signalR SignalR_CreateOrUpdate
80+
description: Quick start with AppConfiguration ConfigurationStores
5281
steps:
53-
- step: SignalR_CreateOrUpdate
54-
exampleFile: ../examples/SignalR_CreateOrUpdate.json
55-
- step: SignalR_Delete
56-
exampleFile: ../examples/SignalR_Delete.json
82+
- step: Operations_CheckNameAvailability
83+
operationId: Operations_CheckNameAvailability
84+
parameters:
85+
checkNameAvailabilityParameters:
86+
name: $(configStoreName)
87+
type: Microsoft.AppConfiguration/configurationStores
88+
- step: ConfigurationStores_Create
89+
operationId: ConfigurationStores_Create
90+
parameters:
91+
configStoreCreationParameters:
92+
location: $(location)
93+
sku:
94+
name: Standard
95+
tags:
96+
myTag: myTagValue
97+
- step: ConfigurationStores_Get
98+
operationId: ConfigurationStores_Get
5799
```
58100
59-
#### 2. create your env file
101+
#### 2. Create env file
60102
61103
The `env.json` file contains required API scenario variables such as, subscriptionId, AAD applicationId, AAD applicationSecret.
62104

63105
```json
64106
{
65107
"subscriptionId": "<my subscription id>",
66-
"location": "westus",
108+
"location": "westcentralus",
67109
"tenantId": "<AAD app tenantId>",
68110
"client_id": "<my add client_id>",
69111
"client_secret": "<my aad client_secret>"
70112
}
71113
```
72114

73-
#### 3. Run api test
115+
#### 3. Run API Scenario test
74116

75117
```sh
76-
oav run /home/user/azure-rest-api-specs/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2020-07-01-preview/scenarios/signalR.yaml -e env.json
118+
oav run ~/workspace/azure-rest-api-specs/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/scenarios/quickstart.yaml --tag=package-2022-05-01 -e env.json --verbose
77119
```
78120

79-
#### 4. Debug with postman
121+
#### 4. Debug with Postman
80122

81-
Sometimes the command `oav run` may fail due to non 2xx HTTP status code. Now you need to debug the API scenario with postman.
123+
Sometimes the command `oav run` may fail due to non 2xx HTTP status code. Now you need to debug the API scenario with Postman.
82124

83-
When run `run`, it automatically generate postman collection and postman env in `generated/<providerNamespace>/<apiScenarioFile>/<runId>/<apiScenario>` folder. Here is the generated file folder structure. The `collection.json` and `env.json` is generated postman collection file and environment file. `202105120922-5c3x5` is current runId. For each run command it will generated unique runId.
125+
When run `run`, it automatically generate Postman collection and postman env in `.apitest/<apiScenarioFile>/<runId>/<scenario>` folder. Here is the output folder structure. The `collection.json` and `env.json` is generated postman collection file and environment file. `202207221820-cyq4mk` is the runId, generated uniquely for each run command.
84126

85127
```
86-
generated
87-
└── Microsoft.SignalRService
88-
└── 2020-07-01-preview
89-
└── signalR
90-
└── 202105120922-5c3x5
91-
├── signalR_0
92-
│ ├── collection.json
93-
│ └── env.json
94-
| |__ report.json
95-
└── signalR_0.json
128+
.apitest
129+
└── quickstart.yaml
130+
└── 202207221820-cyq4mk
131+
├── quickStart
132+
│ ├── collection.json
133+
│ ├── env.json
134+
│ └── report.json
135+
└── quickStart.json
96136
```
97137
98138
Postman is a widely used GUI API testing tool. And you could use Postman import the generated postman collection and env for your local debug.
99139
100140
![import-postman-collection](./import-postman-collection.png)
101141
102-
After you import postman collection, you will get such requests. Now you could debug API test with postman locally.
142+
After you import Postman collection, you will get such requests. Now you could debug API test with postman locally.
103143
104-
![postman-collection-signalr](./postman-collection-signalr.PNG)
144+
![postman-collection-list](./postman-collection-list.PNG)
105145
106-
#### 5. manual update example value
146+
#### 5. Manual update API Scenario or example
107147
108-
After debug with postman, you need to rewrite back all the updated values and run `oav run <api-scenario-file> -e <env.json>` again. The result should be successful.
148+
After debug with Postman, you need to rewrite back all the updated values and run `oav run <api-scenario-file> -e <env.json>` again. The result should be successful.
109149
110150
## Feedback
111151

documentation/api-scenario/how-to/apiScenarioWithARMTemplate.md

Lines changed: 0 additions & 105 deletions
This file was deleted.

documentation/api-scenario/how-to/folder-structure.png

100755100644
55.2 KB
Loading
Binary file not shown.

0 commit comments

Comments
 (0)