runner-runtime 1.0.37 → 1.0.39

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/events/api.js CHANGED
@@ -1554,10 +1554,7 @@ async function convert2EchoResponse(response, history) {
1554
1554
  }
1555
1555
 
1556
1556
  _.assign(cloneResponse, { mimeType, fitForShow });
1557
- } catch (e) {
1558
-
1559
- console.log(e, 1111)
1560
- }
1557
+ } catch (e) { }
1561
1558
 
1562
1559
  // 响应头对象
1563
1560
  const responseHeader = {};
@@ -1668,7 +1665,6 @@ const preProcessMockExp = (request, requestPara, AllVars, option) => {
1668
1665
 
1669
1666
  // 重置 restful
1670
1667
  _.forEach(_.get(postmanJSON, 'url.path'), (item, key) => { //variable
1671
- // console.log(item)
1672
1668
  if (_.startsWith(item, ":")) {
1673
1669
  const pathVarKey = _.findKey(_.get(postmanJSON, 'url.variable'), (vars) => {
1674
1670
  return vars?.key == _.trimStart(item, ':')
@@ -1786,7 +1782,7 @@ const initRequestJson = (event, option) => {
1786
1782
  } else {
1787
1783
  getParentTargetIDs(option?.collection, _.get(event, `data.target_id`), parentIDs);
1788
1784
  }
1789
-
1785
+
1790
1786
  if (!_.includes(parentIDs, "0")) {
1791
1787
  parentIDs.push("0");
1792
1788
  }
@@ -1800,7 +1796,7 @@ const initRequestJson = (event, option) => {
1800
1796
  // 目录参数
1801
1797
  _.assign(request, _.get(getAPIFromCollection(option?.collection, parent_id), "request"));
1802
1798
  }
1803
-
1799
+
1804
1800
  if (_.isObject(request) && !_.isEmpty(request)) {
1805
1801
  ["header", "body", "query", "cookie"].forEach((parameter) => {
1806
1802
  let arrPara = _.filter(_.get(request, `${parameter}.parameter`), (item) => { return _.toInteger(item.is_system) > 0 || item.is_checked > 0 });
@@ -2202,7 +2198,7 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2202
2198
  })
2203
2199
  }
2204
2200
  }
2205
-
2201
+
2206
2202
  const requestOptions = convert2EchoRequest(request, requestJson, postmanJSON, history);
2207
2203
  _.set(eventRuntimeData, [event?.event_id, "request"], requestOptions);
2208
2204
 
@@ -2228,11 +2224,14 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2228
2224
  },
2229
2225
 
2230
2226
  test(err, cursor, results, item) {
2227
+ console.log(4444444, err)
2231
2228
  if (!err) {
2232
2229
  if (!_.includes(['get_parsed_request'], scene)) {
2230
+
2233
2231
  _.forEach(results, (result) => {
2234
2232
  _.forEach(['_variables', 'environment', 'globals'], (varType) => {
2235
2233
  const currentVar = _.get(result, `result.${varType}`);
2234
+
2236
2235
  try {
2237
2236
  _.forEach(currentVar.toObject(), (val, key) => {
2238
2237
  let setPath = varType;
@@ -2253,16 +2252,12 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2253
2252
  },
2254
2253
 
2255
2254
  assertion(cursor, assertions) {
2256
- // console.log(assertions,`assertionsassertionsassertionsassertionsassertionsassertions`)
2257
2255
  if (!_.includes(['get_parsed_request'], scene)) {
2258
2256
  if (!_.isEmpty(assertions) && _.isArray(assertions)) {
2259
2257
  if (_.isUndefined(_.get(eventRuntimeData, [event?.event_id, "assertions"]))) {
2260
2258
  _.set(eventRuntimeData, [event?.event_id, "assertions"], []);
2261
2259
  }
2262
- // eventRuntimeData[event?.event_id].assertions = _.cloneDeep(assertions)
2263
2260
  eventRuntimeData[event?.event_id].assertions = _.unionWith(_.concat(_.get(eventRuntimeData, [event?.event_id, "assertions"]), assertions), _.isEqual);
2264
-
2265
- // console.log(eventRuntimeData[event?.event_id].assertions,111111)
2266
2261
  }
2267
2262
  }
2268
2263
  },
@@ -2297,7 +2292,7 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2297
2292
  })
2298
2293
 
2299
2294
  _.set(eventRuntimeData, [event?.event_id, "status"], {
2300
- assert: _.get(eventRuntimeData,[event?.event_id, "assertions"]),
2295
+ assert: _.get(eventRuntimeData, [event?.event_id, "assertions"]),
2301
2296
  success_assert,
2302
2297
  http: _.get(eventRuntimeData, [event?.event_id, 'response', 'status']) || _.get(eventRuntimeData, [event?.event_id, 'error', 'message'])
2303
2298
  });
package/events/index.js CHANGED
@@ -57,7 +57,6 @@ const events = {
57
57
  const { iterationData, enable_data } = data;
58
58
 
59
59
  if (_.toInteger(enable_data) > 0) {
60
- console.log(_.assign(_.cloneDeep(option), { iterationData }), 11111111111111)
61
60
  await iterationEvent(children, _.assign(_.cloneDeep(option), { iterationData }), callback, eventRuntimeData, eventResultList)
62
61
  } else {
63
62
  await iterationEvent(children, option, callback, eventRuntimeData, eventResultList)
@@ -202,10 +201,10 @@ const events = {
202
201
  await iterationEvent(events, _.assign(_.cloneDeep(option), { iterationDataArr: iterationData, sleep, startTime, timeout }), callback, eventRuntimeData, eventResultList)
203
202
  }
204
203
  } else if (_.includes([3], loopType)) {
205
- const condition = _.get(option, 'condition', _.get(data, 'loop_condition', {}));
206
- const exp = variableReplace(condition?.var, eventRuntimeData?.variables, option), compare = condition?.compare, value = variableReplace(condition?.value, eventRuntimeData?.variables, option);
207
- // console.log(exp, compare, value, `loopTypeloopTypeloopTypeloopTypeloopTypeloopTypeloopTypeloopType`, !returnBoolean(exp, compare, value))
208
204
  while (true) {
205
+ const condition = _.get(option, 'condition', _.get(data, 'loop_condition', {}));
206
+ const exp = variableReplace(condition?.var, eventRuntimeData?.variables, option), compare = condition?.compare, value = variableReplace(condition?.value, eventRuntimeData?.variables, option);
207
+
209
208
  if ((timeout === 0 || (timeout > 0 && startTime + timeout > Date.now())) && !returnBoolean(exp, compare, value)) {
210
209
  await iterationEvent(_.cloneDeep(children), _.assign(_.cloneDeep(option), { iterationDataArr: iterationData, sleep, condition, startTime, timeout }), callback, eventRuntimeData, eventResultList);
211
210
  } else {
@@ -220,7 +219,6 @@ const events = {
220
219
  current_event_id: event?.event_id
221
220
  });
222
221
  } catch (e) {
223
- console.log(e, 1111111)
224
222
  return ({
225
223
  action: 'stystemError',
226
224
  message: String(e),
@@ -232,9 +230,8 @@ const events = {
232
230
 
233
231
  // 调度器核心函数,用于递归执行具体场景步骤
234
232
  const executeEvent = (event, option, callback, eventRuntimeData, eventResultList) => {
235
- _.assign(eventRuntimeData?.variables?.iterationData, _.get(option, 'iterationData'))
236
- // console.log(option,`optionoptionoptionoptionoptionoptionoptionoption`)
237
233
  return new Promise((resolve, reject) => {
234
+ _.assign(eventRuntimeData?.variables?.iterationData, _.get(option, 'iterationData'))
238
235
  _.set(eventRuntimeData, [event.event_id, 'iteration_id'], aTools.snowflakeId());
239
236
 
240
237
  const eventCall = _.get(events, `${event?.type}`);
package/libs/2har.js CHANGED
@@ -18,7 +18,6 @@
18
18
  * @returns {Object} HAR format JSON object.
19
19
  */
20
20
  function generateHarFromRequest(options) {
21
- // console.log(options)
22
21
  const {
23
22
  url,
24
23
  method = 'GET',
@@ -106,7 +105,6 @@ function processQueryString(queryParams) {
106
105
  * @returns {Object|undefined} HAR postData object.
107
106
  */
108
107
  function processBody(body) {
109
- // console.log(body)
110
108
  const { mode } = body;
111
109
 
112
110
  if (mode === 'none') {
package/libs/utils.js CHANGED
@@ -25,7 +25,7 @@ const getParentTargetIDs = function (collection, target_id, parent_ids) {
25
25
  return;
26
26
  }
27
27
 
28
- if(_.isString(item.parent_id)){
28
+ if (_.isString(item.parent_id)) {
29
29
  parent_ids.push(item.parent_id);
30
30
  getParentTargetIDs(collection, item.parent_id, parent_ids);
31
31
  }
@@ -311,13 +311,15 @@ const getCaseInsensitive = (object, keyToFind) => {
311
311
 
312
312
  const variableReplace = (str, variables, option) => {
313
313
  const AllVars = getInsideVariables();
314
- ["variables", "globals", "environment"].forEach((varName) => {
314
+ ["variables", "globals", "_globals", "environment"].forEach((varName) => {
315
+ console.log(11111111,_.get(variables, `${varName}`))
315
316
  _.assign(AllVars, _.get(variables, `${varName}`))
316
317
  })
318
+
317
319
  str = _.replace(str, /\{\{([^}]+)\}\}/g, (match, key) => {
318
320
  return _.get(AllVars, key.trim(), match);
319
321
  });
320
-
322
+ console.log(2222222, str, _.get(AllVars, 'IF_xunhuan'),_.keys(AllVars))
321
323
  const { lang, custom_functions } = option;
322
324
 
323
325
  try {
@@ -448,7 +450,6 @@ const formatAutotestReportList = (eventResultList) => {
448
450
  type = 'api';
449
451
  }
450
452
 
451
- // console.log(item?.status?.success_assert,3333333333)
452
453
  list.push(_.assign(
453
454
  _.pick(item?.response, ['timings', 'response_time', 'response_at', 'proxy', 'status', 'code', 'response_size']),
454
455
  _.pick(item?.request, ['url', 'method', 'name', 'target_id', 'project_id']),
@@ -491,12 +492,11 @@ const formatAutotestReport = (startTimeAt, eventResultList) => {
491
492
  let totalResponseSize = 0, totalResponseTime = 0
492
493
 
493
494
  _.forEach(_.cloneDeep(eventResultList), (item) => {
494
- console.log(_.cloneDeep(item),898989898898989)
495
495
  if (_.includes(['api', 'sample'], item?.type)) {
496
496
  report.http.total++;
497
497
  totalResponseSize = totalResponseSize + _.toInteger(item?.response?.response_size);
498
498
  totalResponseTime = totalResponseTime + _.toInteger(item?.response?.response_time);
499
- console.log(item?.status?.assert,111111111111)
499
+
500
500
  if (!_.isEmpty(item?.status?.assert) && _.isArray(item?.status?.assert)) {
501
501
  const assertFailure = _.map(item?.status?.assert, (assertItem) => {
502
502
  return assertItem?.passed === false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runner-runtime",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "runner-runtime.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tmp/request.js CHANGED
@@ -1,13 +1,21 @@
1
1
  module.exports ={
2
2
  "option": {
3
3
  "scene": "auto_test",
4
- "globals": {
5
- "quanjustep": "2"
6
- },
4
+ "globals": {},
7
5
  "project": {
8
6
  "request": {
9
7
  "header": {
10
8
  "parameter": [
9
+ {
10
+ "param_id": "3e3d1ae9f3a370",
11
+ "description": "",
12
+ "field_type": "String",
13
+ "is_checked": 1,
14
+ "key": "ABC",
15
+ "value": "Quan-header",
16
+ "not_null": 1,
17
+ "sort": 1
18
+ },
11
19
  {
12
20
  "key": "Accept",
13
21
  "value": "*/*",
@@ -72,19 +80,207 @@ module.exports ={
72
80
  "server_id": "1",
73
81
  "server_type": 1,
74
82
  "uri": ""
83
+ },
84
+ "3e3d1ae9b3a310": {
85
+ "sort": 400,
86
+ "name": "测试服务",
87
+ "server_id": "3e3d1ae9b3a310",
88
+ "server_type": -1,
89
+ "uri": "go.apipost.cn"
90
+ },
91
+ "3e3d1ae9b3a311": {
92
+ "sort": 600,
93
+ "name": "2",
94
+ "server_id": "3e3d1ae9b3a311",
95
+ "server_type": -1,
96
+ "uri": "http://httpbin.org"
75
97
  }
76
98
  },
77
- "environment": {
78
- "loop_while_api_num": "0",
79
- "loop_while_num": "5",
80
- "assert_num": "100",
81
- "key": "value",
82
- "step": "1"
83
- }
99
+ "environment": {}
84
100
  },
85
101
  "cookies": {
86
102
  "switch": 1,
87
- "data": []
103
+ "data": [
104
+ {
105
+ "key": "security_session_verify",
106
+ "value": "4560bdb4c5ddc22643bc99515ea21fcf",
107
+ "expires": "2025-04-19T06:42:55.000Z",
108
+ "path": "/",
109
+ "httpOnly": true,
110
+ "creation": "2025-04-15T22:42:55.236Z",
111
+ "name": "security_session_verify",
112
+ "cookie_id": "2f0cbbc78200f",
113
+ "domain": "echo.apipost.cn",
114
+ "project_id": "3e3d1ae973a30f"
115
+ },
116
+ {
117
+ "key": "security_session_verify",
118
+ "value": "4560bdb4c5ddc22643bc99515ea21fcf",
119
+ "expires": "2025-04-19T04:29:32.000Z",
120
+ "path": "/",
121
+ "httpOnly": true,
122
+ "creation": "2025-04-15T20:29:32.769Z",
123
+ "name": "security_session_verify",
124
+ "cookie_id": "2f0cbbc782010",
125
+ "domain": "echo.apipost.cn",
126
+ "project_id": "3e3d1ae973a30f"
127
+ },
128
+ {
129
+ "key": "cookie-test1-folder",
130
+ "value": "B",
131
+ "expires": "Tue, 15 Apr 2025 23:42:55 GMT",
132
+ "maxAge": 3600,
133
+ "domain": "echo.apipost.cn",
134
+ "path": "/echo",
135
+ "creation": "2025-04-15T22:42:55.235Z",
136
+ "name": "cookie-test1-folder",
137
+ "cookie_id": "2f0cbbc782011",
138
+ "project_id": "3e3d1ae973a30f"
139
+ },
140
+ {
141
+ "key": "cookie-test1",
142
+ "value": "0",
143
+ "expires": "Tue, 15 Apr 2025 23:42:55 GMT",
144
+ "maxAge": 3600,
145
+ "domain": "echo.apipost.cn",
146
+ "path": "/",
147
+ "creation": "2025-04-15T22:42:55.235Z",
148
+ "name": "cookie-test1",
149
+ "cookie_id": "2f0cbbc782012",
150
+ "project_id": "3e3d1ae973a30f"
151
+ },
152
+ {
153
+ "key": "cookie-test2",
154
+ "value": "0",
155
+ "expires": "Tue, 15 Apr 2025 23:42:55 GMT",
156
+ "maxAge": 3600,
157
+ "domain": "echo.apipost.cn",
158
+ "path": "/",
159
+ "creation": "2025-04-15T22:42:55.235Z",
160
+ "name": "cookie-test2",
161
+ "cookie_id": "2f0cbbc782013",
162
+ "project_id": "3e3d1ae973a30f"
163
+ },
164
+ {
165
+ "key": "cookie-test3",
166
+ "value": "%25E4%25BD%25A0%25E5%25A5%25BD",
167
+ "expires": "Tue, 15 Apr 2025 23:42:55 GMT",
168
+ "maxAge": 3600,
169
+ "domain": "echo.apipost.cn",
170
+ "path": "/",
171
+ "creation": "2025-04-15T22:42:55.235Z",
172
+ "name": "cookie-test3",
173
+ "cookie_id": "2f0cbbc782014",
174
+ "project_id": "3e3d1ae973a30f"
175
+ },
176
+ {
177
+ "key": "cookie-test6",
178
+ "value": "deleted",
179
+ "expires": "Tue, 15 Apr 2025 22:42:55 GMT",
180
+ "maxAge": 0,
181
+ "domain": "echo.apipost.cn",
182
+ "path": "/",
183
+ "creation": "2025-04-15T22:42:55.235Z",
184
+ "name": "cookie-test6",
185
+ "cookie_id": "2f0cbbc782017",
186
+ "project_id": "3e3d1ae973a30f"
187
+ },
188
+ {
189
+ "key": "cookie-test7",
190
+ "value": "0",
191
+ "expires": "Tue, 15 Apr 2025 22:42:55 GMT",
192
+ "maxAge": 0,
193
+ "domain": "echo.apipost.cn",
194
+ "path": "/",
195
+ "creation": "2025-04-15T22:42:55.236Z",
196
+ "name": "cookie-test7",
197
+ "cookie_id": "2f0cbbc782018",
198
+ "project_id": "3e3d1ae973a30f"
199
+ },
200
+ {
201
+ "key": "cookie-test8",
202
+ "value": "renge%3D%3D%3B-%2F%3F",
203
+ "creation": "2025-04-15T22:42:55.236Z",
204
+ "name": "cookie-test8",
205
+ "cookie_id": "2f0cbbc782019",
206
+ "domain": "echo.apipost.cn",
207
+ "project_id": "3e3d1ae973a30f"
208
+ },
209
+ {
210
+ "key": "httponly-cookie",
211
+ "value": "httponly-value",
212
+ "httpOnly": true,
213
+ "creation": "2025-04-15T22:42:55.236Z",
214
+ "name": "httponly-cookie",
215
+ "cookie_id": "2f0cbbc78201a",
216
+ "domain": "echo.apipost.cn",
217
+ "project_id": "3e3d1ae973a30f"
218
+ },
219
+ {
220
+ "key": "security_session_verify",
221
+ "value": "4560bdb4c5ddc22643bc99515ea21fcf",
222
+ "expires": "2025-04-19T04:29:32.000Z",
223
+ "path": "/",
224
+ "httpOnly": true,
225
+ "creation": "2025-04-15T20:29:32.771Z",
226
+ "name": "security_session_verify",
227
+ "cookie_id": "2f0cbbc78201b",
228
+ "domain": "echo.apipost.cn",
229
+ "project_id": "3e3d1ae973a30f"
230
+ },
231
+ {
232
+ "key": "cookie-test4",
233
+ "value": "%E4%BD%A0%E5%A5%BD%3D%3D%3D",
234
+ "expires": "Tue, 15 Apr 2025 23:42:55 GMT",
235
+ "maxAge": 3600,
236
+ "domain": "apipost.cn",
237
+ "path": "/",
238
+ "creation": "2025-04-15T22:42:55.235Z",
239
+ "name": "cookie-test4",
240
+ "cookie_id": "2f0cbbc782015",
241
+ "project_id": "3e3d1ae973a30f"
242
+ },
243
+ {
244
+ "key": "cookie-test5",
245
+ "value": "nihao",
246
+ "expires": "Tue, 15 Apr 2025 23:42:55 GMT",
247
+ "maxAge": 3600,
248
+ "domain": "apipost.cn",
249
+ "path": "/",
250
+ "creation": "2025-04-15T22:42:55.235Z",
251
+ "name": "cookie-test5",
252
+ "cookie_id": "2f0cbbc782016",
253
+ "project_id": "3e3d1ae973a30f"
254
+ },
255
+ {
256
+ "key": "liveCookie",
257
+ "value": "gin",
258
+ "maxAge": 120,
259
+ "domain": "go.apipost.cn",
260
+ "path": "/",
261
+ "secure": true,
262
+ "httpOnly": true,
263
+ "creation": "2025-04-15T23:19:44.865Z",
264
+ "name": "liveCookie",
265
+ "cookie_id": "3007900b9c047",
266
+ "expires": "Tue, 15 Apr 2025 23:21:45 GMT",
267
+ "project_id": "3e3d1ae973a30f"
268
+ },
269
+ {
270
+ "key": "loseCookie",
271
+ "value": "gin",
272
+ "maxAge": 0,
273
+ "domain": "go.apipost.cn",
274
+ "path": "/",
275
+ "secure": true,
276
+ "httpOnly": true,
277
+ "creation": "2025-04-15T23:19:44.865Z",
278
+ "name": "loseCookie",
279
+ "cookie_id": "3007900b9c048",
280
+ "expires": "Tue, 15 Apr 2025 23:19:45 GMT",
281
+ "project_id": "3e3d1ae973a30f"
282
+ }
283
+ ]
88
284
  },
89
285
  "system_configs": {
90
286
  "send_timeout": 0,
@@ -116,52 +312,20 @@ module.exports ={
116
312
  "custom_functions": {},
117
313
  "collection": [
118
314
  {
119
- "target_id": "2d15cf8735002",
315
+ "target_id": "3e3d1ae9b3a328",
120
316
  "target_type": "api",
121
- "parent_id": "2d125c0735022",
122
- "name": "/anything",
317
+ "parent_id": "0",
318
+ "name": "body-binary发送接口测试",
123
319
  "request": {
124
320
  "auth": {
125
- "type": "inherit"
321
+ "type": "noauth"
126
322
  },
127
323
  "header": {
128
- "parameter": [
129
- {
130
- "param_id": "2d15ee7f35001",
131
- "key": "accept",
132
- "value": "application/json",
133
- "field_type": "String",
134
- "not_null": 1,
135
- "description": "",
136
- "is_checked": 1,
137
- "content_type": "String"
138
- }
139
- ]
324
+ "parameter": []
140
325
  },
141
326
  "query": {
142
327
  "query_add_equal": 1,
143
- "parameter": [
144
- {
145
- "param_id": "2d1940f39b009",
146
- "key": "msg",
147
- "value": "成功",
148
- "field_type": "string",
149
- "not_null": 1,
150
- "description": "",
151
- "is_checked": 1,
152
- "content_type": "string"
153
- },
154
- {
155
- "param_id": "2d1a59ef9b00a",
156
- "key": "code",
157
- "value": "失败",
158
- "field_type": "integer",
159
- "not_null": 1,
160
- "description": "",
161
- "is_checked": 1,
162
- "content_type": "integer"
163
- }
164
- ]
328
+ "parameter": []
165
329
  },
166
330
  "restful": {
167
331
  "parameter": []
@@ -171,9 +335,12 @@ module.exports ={
171
335
  "parameter": []
172
336
  },
173
337
  "body": {
174
- "mode": "none",
338
+ "mode": "binary",
175
339
  "parameter": [],
176
- "binary": "",
340
+ "binary": {
341
+ "data_url": "",
342
+ "file_name": "PHP脚本.csv"
343
+ },
177
344
  "raw": "",
178
345
  "raw_parameter": [],
179
346
  "raw_schema": {
@@ -183,69 +350,565 @@ module.exports ={
183
350
  "pre_tasks": [],
184
351
  "post_tasks": []
185
352
  },
186
- "parents": [
187
- {
188
- "target_id": "2d125c0735022",
189
- "target_type": "folder"
190
- }
191
- ],
192
- "method": "GET",
353
+ "parents": [],
354
+ "method": "POST",
193
355
  "protocol": "http/1.1",
194
- "url": "https://httpbin.org/anything?msg=成功&code=失败",
356
+ "url": "https://echo.apipost.cn/get.php",
195
357
  "pre_url": ""
196
358
  },
197
359
  {
198
- "target_id": "2d125c0735022",
199
- "target_type": "folder",
360
+ "target_id": "3e3d1ae9b3a329",
361
+ "target_type": "api",
200
362
  "parent_id": "0",
201
- "name": "自动化测试",
363
+ "name": "body-raw发送接口测试",
202
364
  "request": {
365
+ "auth": {
366
+ "type": "noauth"
367
+ },
203
368
  "header": {
204
369
  "parameter": []
205
370
  },
206
371
  "query": {
372
+ "query_add_equal": 1,
373
+ "parameter": []
374
+ },
375
+ "restful": {
376
+ "parameter": []
377
+ },
378
+ "cookie": {
379
+ "cookie_encode": 1,
207
380
  "parameter": []
208
381
  },
209
382
  "body": {
383
+ "mode": "json",
384
+ "parameter": [],
385
+ "binary": {},
386
+ "raw": "{\r\n\t\"222\": \"中文\"\r\n}",
387
+ "raw_parameter": [],
388
+ "raw_schema": {
389
+ "type": "object"
390
+ }
391
+ },
392
+ "pre_tasks": [],
393
+ "post_tasks": []
394
+ },
395
+ "parents": [],
396
+ "method": "POST",
397
+ "protocol": "http/1.1",
398
+ "url": "http://cc.apipost.cc:6002/post",
399
+ "pre_url": ""
400
+ },
401
+ {
402
+ "target_id": "3e3d1ae9b3a32a",
403
+ "target_type": "api",
404
+ "parent_id": "0",
405
+ "name": "body-raw可视化编辑生成的数据发送接口测试",
406
+ "request": {
407
+ "auth": {
408
+ "type": "noauth"
409
+ },
410
+ "header": {
411
+ "parameter": []
412
+ },
413
+ "query": {
414
+ "query_add_equal": 1,
415
+ "parameter": []
416
+ },
417
+ "restful": {
210
418
  "parameter": []
211
419
  },
212
420
  "cookie": {
421
+ "cookie_encode": 1,
213
422
  "parameter": []
214
423
  },
424
+ "body": {
425
+ "mode": "json",
426
+ "parameter": [],
427
+ "binary": {},
428
+ "raw": "{\n\t\"111\": \"16687940807\",\n\t\"222\": \"49\",\n\t\"333\": \"62\"\n}",
429
+ "raw_parameter": [],
430
+ "raw_schema": {
431
+ "type": "object",
432
+ "required": [],
433
+ "properties": {
434
+ "111": {
435
+ "mock": {
436
+ "mock": "@telephone()"
437
+ },
438
+ "type": "string"
439
+ },
440
+ "222": {
441
+ "mock": {
442
+ "mock": "@natural(1,100)"
443
+ },
444
+ "type": "string"
445
+ },
446
+ "333": {
447
+ "mock": {
448
+ "mock": "@integer(1,100)"
449
+ },
450
+ "type": "string"
451
+ }
452
+ },
453
+ "APIPOST_ORDERS": [
454
+ "111",
455
+ "222",
456
+ "333"
457
+ ]
458
+ }
459
+ },
460
+ "pre_tasks": [],
461
+ "post_tasks": []
462
+ },
463
+ "parents": [],
464
+ "method": "POST",
465
+ "protocol": "http/1.1",
466
+ "url": "http://cc.apipost.cc:6002/post",
467
+ "pre_url": ""
468
+ },
469
+ {
470
+ "target_id": "3e3d1ae9b3a31f",
471
+ "target_type": "api",
472
+ "parent_id": "0",
473
+ "name": "全局body参数",
474
+ "request": {
215
475
  "auth": {
216
- "type": "inherit"
476
+ "type": "noauth"
477
+ },
478
+ "header": {
479
+ "parameter": []
480
+ },
481
+ "query": {
482
+ "query_add_equal": 1,
483
+ "parameter": [
484
+ {
485
+ "param_id": "3e3d1aea33a388",
486
+ "key": "body",
487
+ "value": "{{body}}",
488
+ "field_type": "String",
489
+ "not_null": 1,
490
+ "description": "",
491
+ "is_checked": 1,
492
+ "content_type": "String"
493
+ }
494
+ ]
495
+ },
496
+ "restful": {
497
+ "parameter": []
498
+ },
499
+ "cookie": {
500
+ "cookie_encode": 1,
501
+ "parameter": []
502
+ },
503
+ "body": {
504
+ "mode": "form-data",
505
+ "parameter": [
506
+ {
507
+ "param_id": "3e3d1aea33a389",
508
+ "key": "body",
509
+ "value": "{{body}}",
510
+ "field_type": "String",
511
+ "not_null": 1,
512
+ "description": "",
513
+ "is_checked": 1,
514
+ "content_type": "String"
515
+ }
516
+ ],
517
+ "binary": {},
518
+ "raw": "",
519
+ "raw_parameter": [],
520
+ "raw_schema": {
521
+ "type": "object"
522
+ }
217
523
  },
218
524
  "pre_tasks": [],
219
525
  "post_tasks": []
220
526
  },
221
527
  "parents": [],
222
- "server_id": "0",
528
+ "method": "POST",
529
+ "protocol": "http/1.1",
530
+ "url": "go.apipost.cn?body={{body}}",
223
531
  "pre_url": ""
224
532
  }
225
533
  ],
226
534
  "database_configs": {},
227
- "name": "bug-引用单接口-没有断言但是统计了断言执行次数",
535
+ "name": "测试循环控制器",
228
536
  "ignore_error": -1,
229
537
  "enable_sandbox": -1,
230
538
  "iterationCount": 1,
231
539
  "sleep": 0,
232
- "testing_id": "2d62d52b350d1",
233
- "iterates_data_id": "0",
234
- "iterationData": []
540
+ "testing_id": "2de69bbf82149",
541
+ "iterates_data_id": "2deb6b1b8214c",
542
+ "iterationData": [
543
+ {
544
+ "name": "小明",
545
+ "password": "123"
546
+ },
547
+ {
548
+ "name": "小奥",
549
+ "password": "456"
550
+ },
551
+ {
552
+ "name": "小张",
553
+ "password": "789"
554
+ },
555
+ {
556
+ "name": "小李",
557
+ "password": "999"
558
+ }
559
+ ]
235
560
  },
236
561
  "test_events": [
237
562
  {
238
- "type": "api",
239
- "auto_sync": true,
240
- "test_id": "2d62d52b350d1",
241
- "event_id": "2d843f6f350e9",
242
- "enabled": 1,
243
563
  "data": {
244
- "target_id": "2d15cf8735002",
245
- "project_id": "2c310b4f35066",
246
- "parent_id": "2d125c0735022",
247
- "target_type": "api"
248
- }
564
+ "name": "循环-完成所有测试数据的迭代",
565
+ "sleep": 5,
566
+ "loop_type": 1,
567
+ "enable_data": 1,
568
+ "loop_timeout": 0,
569
+ "loop_data_type": 1,
570
+ "loop_traverse_data": {
571
+ "name": "",
572
+ "type": 1,
573
+ "iterationData": [
574
+ {
575
+ "name": "小明",
576
+ "password": "123"
577
+ },
578
+ {
579
+ "name": "小奥",
580
+ "password": "456"
581
+ },
582
+ {
583
+ "name": "小张",
584
+ "password": "789"
585
+ },
586
+ {
587
+ "name": "小李",
588
+ "password": "999"
589
+ }
590
+ ]
591
+ },
592
+ "loop_iteration_data": "2deb6b1b8214c"
593
+ },
594
+ "sort": 0,
595
+ "type": "loop",
596
+ "enabled": -1,
597
+ "test_id": "2de69bbf82149",
598
+ "children": [
599
+ {
600
+ "type": "api",
601
+ "auto_sync": false,
602
+ "test_id": "2de69bbf82149",
603
+ "event_id": "2ded9e0b82159",
604
+ "enabled": 1,
605
+ "data": {
606
+ "target_id": "3e3d1ae9b3a328",
607
+ "project_id": "3e3d1ae973a30f",
608
+ "parent_id": "0",
609
+ "target_type": "api",
610
+ "apiData": {
611
+ "name": "body-binary发送接口测试",
612
+ "method": "POST",
613
+ "protocol": "http/1.1",
614
+ "url": "https://echo.apipost.cn/get.php",
615
+ "request": {
616
+ "auth": {
617
+ "type": "noauth"
618
+ },
619
+ "body": {
620
+ "raw": "",
621
+ "mode": "binary",
622
+ "binary": {
623
+ "data_url": "",
624
+ "file_name": "PHP脚本.csv"
625
+ },
626
+ "parameter": [],
627
+ "raw_schema": {
628
+ "type": "object"
629
+ },
630
+ "raw_parameter": []
631
+ },
632
+ "query": {
633
+ "parameter": [],
634
+ "query_add_equal": 1
635
+ },
636
+ "cookie": {
637
+ "parameter": [],
638
+ "cookie_encode": 1
639
+ },
640
+ "header": {
641
+ "parameter": []
642
+ },
643
+ "restful": {
644
+ "parameter": []
645
+ },
646
+ "pre_tasks": [],
647
+ "post_tasks": []
648
+ }
649
+ }
650
+ }
651
+ },
652
+ {
653
+ "type": "api",
654
+ "auto_sync": false,
655
+ "test_id": "2de69bbf82149",
656
+ "event_id": "2dee042b8215c",
657
+ "enabled": 1,
658
+ "data": {
659
+ "target_id": "3e3d1ae9b3a329",
660
+ "project_id": "3e3d1ae973a30f",
661
+ "parent_id": "0",
662
+ "target_type": "api",
663
+ "apiData": {
664
+ "name": "body-raw发送接口测试",
665
+ "method": "POST",
666
+ "protocol": "http/1.1",
667
+ "url": "http://cc.apipost.cc:6002/post",
668
+ "request": {
669
+ "auth": {
670
+ "type": "noauth"
671
+ },
672
+ "body": {
673
+ "raw": "{\r\n\t\"222\": \"中文\"\r\n}",
674
+ "mode": "json",
675
+ "binary": {},
676
+ "parameter": [],
677
+ "raw_schema": {
678
+ "type": "object"
679
+ },
680
+ "raw_parameter": []
681
+ },
682
+ "query": {
683
+ "parameter": [],
684
+ "query_add_equal": 1
685
+ },
686
+ "cookie": {
687
+ "parameter": [],
688
+ "cookie_encode": 1
689
+ },
690
+ "header": {
691
+ "parameter": []
692
+ },
693
+ "restful": {
694
+ "parameter": []
695
+ },
696
+ "pre_tasks": [],
697
+ "post_tasks": []
698
+ }
699
+ }
700
+ }
701
+ }
702
+ ],
703
+ "event_id": "2ded38b782156",
704
+ "project_id": "3e3d1ae973a30f",
705
+ "parent_event_id": "0"
706
+ },
707
+ {
708
+ "data": {
709
+ "name": "循环-3次固定次数循环",
710
+ "limit": 3,
711
+ "sleep": 0,
712
+ "loop_type": 2,
713
+ "loop_timeout": 0,
714
+ "loop_traverse_data": {
715
+ "name": "",
716
+ "type": 1,
717
+ "iterationData": []
718
+ }
719
+ },
720
+ "sort": 3,
721
+ "type": "loop",
722
+ "enabled": -1,
723
+ "test_id": "2de69bbf82149",
724
+ "children": [
725
+ {
726
+ "type": "api",
727
+ "auto_sync": false,
728
+ "test_id": "2de69bbf82149",
729
+ "event_id": "2df45d5382161",
730
+ "enabled": 1,
731
+ "data": {
732
+ "target_id": "3e3d1ae9b3a32a",
733
+ "project_id": "3e3d1ae973a30f",
734
+ "parent_id": "0",
735
+ "target_type": "api",
736
+ "apiData": {
737
+ "name": "body-raw可视化编辑生成的数据发送接口测试",
738
+ "method": "POST",
739
+ "protocol": "http/1.1",
740
+ "url": "http://cc.apipost.cc:6002/post",
741
+ "request": {
742
+ "auth": {
743
+ "type": "noauth"
744
+ },
745
+ "body": {
746
+ "raw": "{\n\t\"111\": \"16687940807\",\n\t\"222\": \"49\",\n\t\"333\": \"62\"\n}",
747
+ "mode": "json",
748
+ "binary": {},
749
+ "parameter": [],
750
+ "raw_schema": {
751
+ "type": "object",
752
+ "required": [],
753
+ "properties": {
754
+ "111": {
755
+ "mock": {
756
+ "mock": "@telephone()"
757
+ },
758
+ "type": "string"
759
+ },
760
+ "222": {
761
+ "mock": {
762
+ "mock": "@natural(1,100)"
763
+ },
764
+ "type": "string"
765
+ },
766
+ "333": {
767
+ "mock": {
768
+ "mock": "@integer(1,100)"
769
+ },
770
+ "type": "string"
771
+ }
772
+ },
773
+ "APIPOST_ORDERS": [
774
+ "111",
775
+ "222",
776
+ "333"
777
+ ]
778
+ },
779
+ "raw_parameter": []
780
+ },
781
+ "query": {
782
+ "parameter": [],
783
+ "query_add_equal": 1
784
+ },
785
+ "cookie": {
786
+ "parameter": [],
787
+ "cookie_encode": 1
788
+ },
789
+ "header": {
790
+ "parameter": []
791
+ },
792
+ "restful": {
793
+ "parameter": []
794
+ },
795
+ "pre_tasks": [],
796
+ "post_tasks": []
797
+ }
798
+ }
799
+ }
800
+ }
801
+ ],
802
+ "event_id": "2df3cae38215e",
803
+ "project_id": "3e3d1ae973a30f",
804
+ "parent_event_id": "0"
805
+ },
806
+ {
807
+ "data": {
808
+ "name": "满足条件时退出循环",
809
+ "sleep": 0,
810
+ "loop_type": 3,
811
+ "loop_timeout": 0,
812
+ "loop_condition": {
813
+ "var": "{{IF_xunhuan}}",
814
+ "value": "跳出循环2",
815
+ "compare": "eq"
816
+ },
817
+ "loop_traverse_data": {
818
+ "name": "",
819
+ "type": 1,
820
+ "iterationData": []
821
+ }
822
+ },
823
+ "sort": 5,
824
+ "type": "loop",
825
+ "enabled": 1,
826
+ "test_id": "2de69bbf82149",
827
+ "event_id": "2dfedc1382163",
828
+ "project_id": "3e3d1ae973a30f",
829
+ "parent_event_id": "0",
830
+ "children": [
831
+ {
832
+ "type": "api",
833
+ "auto_sync": false,
834
+ "test_id": "2de69bbf82149",
835
+ "event_id": "2dff808382166",
836
+ "enabled": 1,
837
+ "data": {
838
+ "target_id": "3e3d1ae9b3a31f",
839
+ "project_id": "3e3d1ae973a30f",
840
+ "parent_id": "0",
841
+ "target_type": "api",
842
+ "apiData": {
843
+ "name": "全局body参数",
844
+ "method": "POST",
845
+ "protocol": "http/1.1",
846
+ "url": "go.apipost.cn?body={{body}}",
847
+ "request": {
848
+ "auth": {
849
+ "type": "noauth"
850
+ },
851
+ "body": {
852
+ "raw": "",
853
+ "mode": "form-data",
854
+ "binary": {},
855
+ "parameter": [
856
+ {
857
+ "key": "body",
858
+ "value": "{{body}}",
859
+ "not_null": 1,
860
+ "param_id": "3e3d1aea33a389",
861
+ "field_type": "String",
862
+ "is_checked": 1,
863
+ "description": "",
864
+ "content_type": "String"
865
+ }
866
+ ],
867
+ "raw_schema": {
868
+ "type": "object"
869
+ },
870
+ "raw_parameter": []
871
+ },
872
+ "query": {
873
+ "parameter": [
874
+ {
875
+ "key": "body",
876
+ "value": "{{body}}",
877
+ "not_null": 1,
878
+ "param_id": "3e3d1aea33a388",
879
+ "field_type": "String",
880
+ "is_checked": 1,
881
+ "description": "",
882
+ "content_type": "String"
883
+ }
884
+ ],
885
+ "query_add_equal": 1
886
+ },
887
+ "cookie": {
888
+ "parameter": [],
889
+ "cookie_encode": 1
890
+ },
891
+ "header": {
892
+ "parameter": []
893
+ },
894
+ "restful": {
895
+ "parameter": []
896
+ },
897
+ "pre_tasks": [],
898
+ "post_tasks": [
899
+ {
900
+ "id": "2e0170fb82174",
901
+ "data": "apt.globals.set(\"IF_xunhuan\", \"跳出循环2\");",
902
+ "name": "自定义脚本",
903
+ "type": "customScript",
904
+ "enabled": 1
905
+ }
906
+ ]
907
+ }
908
+ }
909
+ }
910
+ }
911
+ ]
249
912
  }
250
913
  ]
251
- }
914
+ }