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
* readme update
* swagger processor updates, many new tests
* Refactoring to remove replaceer and generator from the library, enum support, test refactoring, readme update
* Add Pet tests, Test refactorings, ContentType refactored to Support enums
* code cleanup
* Update and delete pet tests
* upload image test
* additional test with readme update
* small bug fixes and test upgrade
* alpha 1
* Custom exception, cleanup
* cleanup
* refactorings, more tests
* code analysis and build only on pull requests
* small code refactoring
@@ -51,24 +41,13 @@ The above code is quite simple, but it needs some explanation.
51
41
52
42
## Description
53
43
54
-
#### 1. AddReplacementValues
55
-
This is a method that will add key/value pairs for replacement values you need to replace in the Swagger requests.
56
-
57
-
In the example above we say: "Replace `{version}` placeholder in Path and URL parameters and JSON body models."
58
-
59
-
In other words, if you have a test API endpoint like this: https://api.demo.com/v{version}/categories?parent={parentId} that will be set to https://api.demo.com/v1/categories?parent=4.
60
-
61
-
That, does not stop there, you can also populate JSON request bodies in this way:
62
-
63
-
[TODO sample JSON Body]
64
-
65
-
#### 2. AddBasicAuthentication
44
+
#### 1. AddBasicAuthentication
66
45
If your Swagger.json files are protected by basic authentication, you can set those with `AddBasicAuthentication`.
67
46
68
-
#### 3, AddRequestFilters
69
-
Filters comprise of different types. Those are `AuthenticationTypes`, `TestTypes` and `EndpointNameWhitelist`.
47
+
#### 2. AddRequestFilters
48
+
Filters comprise of different types. Those are `AuthenticationTypes`, `TestTypes` and `EndpointNameWhitelist`. All are optional.
70
49
71
-
##### 3.1. AuthenticationTypes
50
+
##### 2.1. AuthenticationTypes
72
51
Here we specify a list of Authentication types, that will be filtered out from the whole swagger file. This is where QA Tool Kit presents a convention.
73
52
The built-in types are:
74
53
-`AuthenticationType.Customer` which specifies a string `"@customer"`,
@@ -79,7 +58,7 @@ The built-in types are:
79
58
80
59
In order to apply filters, you need to tag your API endpoints with those strings.
81
60
82
-
We normally do it in Swagger endpoint description. An example might be: `Get categories from the system. @customer,@administrator,@oauth2.`
61
+
We normally do that, by adding the tags in the Swagger endpoint description. An example might be: `Get categories from the system. @customer,@administrator,@oauth2.`
83
62
84
63
This is an example from swagger.json excerpt:
85
64
@@ -96,14 +75,14 @@ This is an example from swagger.json excerpt:
96
75
97
76
Parser then finds those string in the description field and populates the `RequestFilter` property.
98
77
99
-
##### 3.2 TestTypes
100
-
Similarly as in the `AuthenticationTypes` you can filter out certain endpoints to be used in certain test scenarios. Currently libraray supports:
78
+
##### 2.2 TestTypes
79
+
Similarly as in the `AuthenticationTypes` you can filter out certain endpoints to be used in different test scenarios. Currently library supports:
101
80
102
81
- TestType.LoadTest which specifies a string `"@loadtest"`,
103
82
- TestType.IntegrationTest which specifies a string `"@integrationtest"`,
104
83
- TestType.SecurityTest which specifies a string `"@securitytest"`,
105
84
106
-
The same swagger-json excerpt which allows load and integration tests.
85
+
The same swagger.json excerpt which support test type tags might look like this:
107
86
108
87
```json
109
88
"/v{version}/categories?parent={parentId}": {
@@ -116,14 +95,35 @@ The same swagger-json excerpt which allows load and integration tests.
116
95
"operationId": "GetCategories",
117
96
```
118
97
119
-
##### 3.3 EndpointNameWhitelist
98
+
If you feed the list of `HttpRequest` objects with load type tags to the library like `QAToolKit.Engine.Bombardier`, only those requests will be tested.
99
+
100
+
##### 2.3 EndpointNameWhitelist
120
101
Final `RequestFilter` option is `EndpointNameWhitelist`. With it you can specify a list of endpoints that will be included in the results.
121
102
122
-
Every other endpoint will be excluded. In the sample above we have set the result to include only `GetCategories` endpoint. That corresponds to the `operationId` in the swagger file above.
103
+
Every other endpoint will be excluded. In the sample above we have set the result to include only `GetCategories` endpoint.
104
+
That corresponds to the `operationId` in the swagger file above.
105
+
106
+
#### 3. AddBaseUrl
107
+
Your swagger file has a `Server section`, where you can specify an server URI and can be absolute or relative. An example of relative server section is:
108
+
```json
109
+
"servers": [
110
+
{
111
+
"url": "/api/v3"
112
+
}
113
+
],
114
+
```
115
+
In case of relative paths you need to add an absolute base URL to `Swagger Processor` with `AddBaseUrl`, otherwise the one from the `Servers section` will be used.
116
+
117
+
#### 4. UseSwaggerExampleValues
118
+
You can set `UseSwaggerExampleValues = true` in the SwaggerOptions when creating new Swagger source object. This will
119
+
check Swagger for example files and populate those.
120
+
121
+
By default this option is set to false.
123
122
124
-
## TO-DO
123
+
## Limitations
125
124
126
-
- Support for automatic model data generation.
125
+
- Swagger processor only returns `application/json` content type. Support for other might come later.
126
+
- Data generation and replacement is only supported for Path, Url and Json Body properties.
0 commit comments