You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/api-scenario/how-to/QuickStart.md
+16-15Lines changed: 16 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,15 @@
14
14
```sh
15
15
npm install -g oav@latest
16
16
```
17
+
17
18
### OAV Features
19
+
18
20
- Very easy to use and run.
19
21
- Support postman collection format. Debug easily.
20
22
- Request response validation. `oav` implement a powerful validation algorithm and help developer to detect service issue in the early phase.
21
-
- Validation result report. After each run test scenario, developer will get a validation report which contains detect issue in api test.
23
+
- Validation result report. After each run API scenario, developer will get a validation report which contains detect issue in api test.
22
24
- Integrate everywhere. Easily integrate with azure-pipeline, cloud-test.
23
25
24
-
25
26
## Create AAD app
26
27
27
28
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.
@@ -30,24 +31,24 @@ For how to create AAD app, please follow this doc https://docs.microsoft.com/en-
30
31
31
32
## Authoring steps
32
33
33
-
We will write test scenario file for SignalR service as an example.
34
+
We will write API scenario file for SignalR service as an example.
34
35
35
-
#### 1. Write your first test scenario file
36
+
#### 1. Write your first API scenario file
36
37
37
-
First, create a folder `scenarios` under the api version folder. All test scenario files under the `scenarios` folder should bind with the api version.
38
+
First, create a folder `scenarios` under the api version folder. All API scenario files under the `scenarios` folder should bind with the api version.
38
39
39
40

40
41
41
-
Now write your basic test scenario. For more detail about test scenario file format, please refer to
The `env.json` file contains required test scenario variables such as, subscriptionId, AAD applicationId, AAD applicationSecret.
61
+
The `env.json` file contains required API scenario variables such as, subscriptionId, AAD applicationId, AAD applicationSecret.
61
62
62
63
```json
63
64
{
@@ -77,9 +78,9 @@ oav run /home/user/azure-rest-api-specs/specification/signalr/resource-manager/M
77
78
78
79
#### 4. Debug with postman
79
80
80
-
Sometimes the command `oav run` may fail due to non 2xx HTTP status code. Now you need to debug the test scenario with postman.
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.
81
82
82
-
When run `run`, it automatically generate postman collection and postman env in `generated/<providerNamespace>/<testScenarioFile>/<runId>/<testScenario>` 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.
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.
83
84
84
85
```
85
86
generated
@@ -104,7 +105,7 @@ After you import postman collection, you will get such requests. Now you could d
104
105
105
106
#### 5. manual update example value
106
107
107
-
After debug with postman, you need to rewrite back all the updated values and run `oav run <test-scenario-file> -e <env.json>` again. The result should be successful.
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.
Copy file name to clipboardExpand all lines: documentation/api-scenario/how-to/apiScenarioWithARMTemplate.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Test scenario integrate with armTemplate
1
+
# API scenario integrate with armTemplate
2
2
3
3
## Background
4
4
@@ -13,7 +13,7 @@ Here is an example about `generate unique resource name for signalR service`
13
13
14
14
#### Generate unique resource name
15
15
16
-
We use `armTemplate output` to overwrite `resourceName` variable and following `createResource` step will use this variable. Below is generate unique name armTemplate. This armTemplate output `resourceName` variables, so test scenario following step will using the output variable.
16
+
We use `armTemplate output` to overwrite `resourceName` variable and following `createResource` step will use this variable. Below is generate unique name armTemplate. This armTemplate output `resourceName` variables, so API scenario following step will using the output variable.
17
17
18
18
```json
19
19
{
@@ -38,7 +38,7 @@ We use `armTemplate output` to overwrite `resourceName` variable and following `
38
38
}
39
39
```
40
40
41
-
After we have this armTemplate, we could define current test scenario file. We defined `resourceName` variable globally. `./generate_unique_string.json` is armTemplate.
41
+
After we have this armTemplate, we could define current API scenario file. We defined `resourceName` variable globally. `./generate_unique_string.json` is armTemplate.
42
42
43
43
`SignalR_CreateOrUpdate.json`
44
44
@@ -80,8 +80,9 @@ After we have this armTemplate, we could define current test scenario file. We d
We use `oav` tools to generate basic API scenario. `oav` analyze swagger file and use swagger example as API scenario steps. So first, you need to install the latest oav.
6
+
7
+
## Introduction
8
+
9
+
`oav` support rule based API scenario file generation. We use this command to generate API scenario file.
- tag: which tag to generate. oav will analyze swagger file under the tag and generate API scenario.
15
+
- rules: Currently support two types. `resource-put-delete`, `operations-list`. Default: `resource-put-delete`
16
+
-`resource-put-delete`: generate resource put and delete API scenario.
17
+
-`operations-list`: generate operations list API scenario. `operations-list` is the simplest API which must be defined in swagger.
18
+
19
+
Example:
20
+
21
+

22
+
23
+
This command will load and analyze swagger and generate a basic API scenario file (`resource-put-delete`).
24
+
25
+
Result: the output contains two files
26
+
27
+
- scenarios/signalR.yaml: The API scenario file.
28
+
- readme.test.md: The entry for SDK test generation
29
+
30
+
The generated API scenario file: The generated API scenario file contains two steps. Create signalR and delete it. It's a basic API scenario and developer can add more step based on the basic API scenario file.
API Scenario is a YAML file defining RESTful API usage scenarios of your service with a series of API calls. API scenario can be used for service functional test, API quality validation and SDK/CLIs test generation.
4
+
5
+
_**Caution**: This project is in early preview phase, hence breaking changes should be expected._
6
+
7
+
## Features
8
+
9
+
- Simple to use: Intuitive step definition based on Swagger examples and raw REST call.
10
+
- ARM Template integration: Support creating external Azure resources with ARM Template and executing Azure Powershell or Azure CLI scripts with ARM Template deployment script.
11
+
- Implementation independent: [oav](https://github.com/Azure/oav) is the default API scenario runner, and more runners will be supported, like SDKs in different languages.
12
+
13
+
### Demo gif
14
+
15
+

16
+
17
+
## Quick start
18
+
19
+
-[Example: Write and run your first API scenario file](./how-to/QuickStart.md)
20
+
-[Example: Generate a basic API scenario file](./how-to/generateABasicApiScenario.md)
21
+
-[Example: use armTemplate to generate unique resourceName](./how-to/apiScenarioWithARMTemplate.md)
0 commit comments