newman-reporter-qase 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +18 -1
- package/dist/reporter.d.ts +2 -2
- package/dist/reporter.js +16 -12
- package/docs/usage.md +60 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# qase-newman@2.0.4
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Resolved error when uploading results due to bad request:
|
|
6
|
+
|
|
7
|
+
```log
|
|
8
|
+
Error: Error on uploading results: Bad request. Body:
|
|
9
|
+
{"message":"The execution.start time must be at least 1732623290. (and 1 more error)","errors":{"execution.start_time":["The execution.start time must be at least 1732623290."],"execution.end_time":["The execution.end time must be at least 1732623290."]}}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
# qase-newman@2.0.3
|
|
13
|
+
|
|
14
|
+
## What's new
|
|
15
|
+
|
|
16
|
+
Added support parameters from data files in Newman on collection and folder levels.
|
|
17
|
+
|
|
1
18
|
# qase-newman@2.0.2
|
|
2
19
|
|
|
3
20
|
## What's new
|
|
@@ -21,7 +38,7 @@ For more information about the new features and a guide for migration from v1, r
|
|
|
21
38
|
|
|
22
39
|
## What's new
|
|
23
40
|
|
|
24
|
-
Add support for suites in test results.
|
|
41
|
+
Add support for suites in test results.
|
|
25
42
|
|
|
26
43
|
# qase-newman@2.0.0-beta.1
|
|
27
44
|
|
package/dist/reporter.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class NewmanQaseReporter {
|
|
|
22
22
|
*/
|
|
23
23
|
private static getCaseIds;
|
|
24
24
|
/**
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {Item} item
|
|
26
26
|
* @returns {string[]}
|
|
27
27
|
* @private
|
|
28
28
|
*/
|
|
@@ -82,7 +82,7 @@ export declare class NewmanQaseReporter {
|
|
|
82
82
|
*/
|
|
83
83
|
private getSignature;
|
|
84
84
|
/**
|
|
85
|
-
* @param {
|
|
85
|
+
* @param {Item} item
|
|
86
86
|
* @param {number} iteration
|
|
87
87
|
* @returns {Record<string, string>}
|
|
88
88
|
* @private
|
package/dist/reporter.js
CHANGED
|
@@ -31,13 +31,13 @@ class NewmanQaseReporter {
|
|
|
31
31
|
return ids;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* @param {
|
|
34
|
+
* @param {Item} item
|
|
35
35
|
* @returns {string[]}
|
|
36
36
|
* @private
|
|
37
37
|
*/
|
|
38
|
-
static getParameters(
|
|
38
|
+
static getParameters(item) {
|
|
39
39
|
const params = [];
|
|
40
|
-
|
|
40
|
+
item.events.each((event) => {
|
|
41
41
|
if (event.listen === 'test' && event.script.exec) {
|
|
42
42
|
event.script.exec.forEach((line) => {
|
|
43
43
|
const match = line.match(NewmanQaseReporter.qaseParamRegExp);
|
|
@@ -48,6 +48,10 @@ class NewmanQaseReporter {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
const parent = item.parent();
|
|
52
|
+
if (parent && 'events' in parent) {
|
|
53
|
+
params.push(...NewmanQaseReporter.getParameters(parent));
|
|
54
|
+
}
|
|
51
55
|
return params;
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
@@ -131,8 +135,8 @@ class NewmanQaseReporter {
|
|
|
131
135
|
author: null,
|
|
132
136
|
execution: {
|
|
133
137
|
status: qase_javascript_commons_1.TestStatusEnum.passed,
|
|
134
|
-
start_time:
|
|
135
|
-
end_time:
|
|
138
|
+
start_time: null,
|
|
139
|
+
end_time: null,
|
|
136
140
|
duration: 0,
|
|
137
141
|
stacktrace: null,
|
|
138
142
|
thread: null,
|
|
@@ -170,7 +174,7 @@ class NewmanQaseReporter {
|
|
|
170
174
|
const now = Date.now();
|
|
171
175
|
pendingResult.execution.duration = now - timer;
|
|
172
176
|
}
|
|
173
|
-
pendingResult.params = this.prepareParameters(item
|
|
177
|
+
pendingResult.params = this.prepareParameters(item, exec.cursor.iteration);
|
|
174
178
|
void this.reporter.addTestResult(pendingResult);
|
|
175
179
|
}
|
|
176
180
|
});
|
|
@@ -214,17 +218,17 @@ class NewmanQaseReporter {
|
|
|
214
218
|
return signature;
|
|
215
219
|
}
|
|
216
220
|
/**
|
|
217
|
-
* @param {
|
|
221
|
+
* @param {Item} item
|
|
218
222
|
* @param {number} iteration
|
|
219
223
|
* @returns {Record<string, string>}
|
|
220
224
|
* @private
|
|
221
225
|
*/
|
|
222
|
-
prepareParameters(
|
|
226
|
+
prepareParameters(item, iteration) {
|
|
223
227
|
if (this.parameters.length === 0) {
|
|
224
228
|
return {};
|
|
225
229
|
}
|
|
226
230
|
const availableParameters = this.parameters[iteration] ?? {};
|
|
227
|
-
const params = NewmanQaseReporter.getParameters(
|
|
231
|
+
const params = NewmanQaseReporter.getParameters(item);
|
|
228
232
|
if (params.length === 0) {
|
|
229
233
|
if (this.autoCollectParams) {
|
|
230
234
|
return availableParameters;
|
|
@@ -232,9 +236,9 @@ class NewmanQaseReporter {
|
|
|
232
236
|
return {};
|
|
233
237
|
}
|
|
234
238
|
return params.reduce((filteredParams, param) => {
|
|
235
|
-
const value = availableParameters[param];
|
|
239
|
+
const value = availableParameters[param.toLowerCase()];
|
|
236
240
|
if (value) {
|
|
237
|
-
filteredParams[param] = value;
|
|
241
|
+
filteredParams[param.toLowerCase()] = value;
|
|
238
242
|
}
|
|
239
243
|
return filteredParams;
|
|
240
244
|
}, {});
|
|
@@ -269,7 +273,7 @@ class NewmanQaseReporter {
|
|
|
269
273
|
Object.assign(record, this.convertToRecord(value, newKey));
|
|
270
274
|
}
|
|
271
275
|
else {
|
|
272
|
-
record[newKey] = String(value);
|
|
276
|
+
record[newKey.toLowerCase()] = String(value);
|
|
273
277
|
}
|
|
274
278
|
}
|
|
275
279
|
}
|
package/docs/usage.md
CHANGED
|
@@ -49,6 +49,66 @@ pm.test("Response has correct name", function() {
|
|
|
49
49
|
});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
You also can specify parameters on collection or folder level. In this case, all tests in collection or folder will have
|
|
53
|
+
these parameters. If test has own parameters, they will be merged with collection or folder parameters.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"info": {
|
|
58
|
+
"_postman_id": "collection_id",
|
|
59
|
+
"name": "Collection Name",
|
|
60
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
61
|
+
},
|
|
62
|
+
"item": [
|
|
63
|
+
{
|
|
64
|
+
"name": "Folder Name",
|
|
65
|
+
"item": [
|
|
66
|
+
{
|
|
67
|
+
"name": "Test Name",
|
|
68
|
+
"event": [
|
|
69
|
+
{
|
|
70
|
+
"listen": "test",
|
|
71
|
+
"script": {
|
|
72
|
+
"type": "text/javascript",
|
|
73
|
+
"exec": [
|
|
74
|
+
"pm.test('Status code is 200', function () {",
|
|
75
|
+
" pm.response.to.have.status(200);",
|
|
76
|
+
"})"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"request": {
|
|
82
|
+
"method": "GET",
|
|
83
|
+
"header": [],
|
|
84
|
+
"url": {
|
|
85
|
+
"raw": "https://api.example.com",
|
|
86
|
+
"host": [
|
|
87
|
+
"api",
|
|
88
|
+
"example",
|
|
89
|
+
"com"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"response": []
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"event": [
|
|
97
|
+
{
|
|
98
|
+
"listen": "test",
|
|
99
|
+
"script": {
|
|
100
|
+
"exec": [
|
|
101
|
+
"// qase.parameters: userId, user.name"
|
|
102
|
+
],
|
|
103
|
+
"type": "text/javascript"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
52
112
|
### Expected Behavior
|
|
53
113
|
|
|
54
114
|
When you run the tests, the following behavior is expected:
|