diff --git a/CHANGELOG.md b/CHANGELOG.md index bd2202fa..bfc7a271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### v1.3.17 +* 请求配置中添加 context.castId 字段用于标识测试用例 + #### Bug Fixed * 修复服务器端测试,邮件通知开启token undefined bug * 将状态由未完成修改成已完成之后,原来的json格式的数据会变成json-schema diff --git a/client/components/Postman/Postman.js b/client/components/Postman/Postman.js index 4b19dcd2..b2a557f3 100755 --- a/client/components/Postman/Postman.js +++ b/client/components/Postman/Postman.js @@ -252,6 +252,7 @@ export default class Run extends Component { this.setState({ loading: true }); + console.log('this.state', this.state); let options = handleParams(this.state, this.handleValue), result; diff --git a/client/containers/Project/Interface/InterfaceCol/InterfaceColContent.js b/client/containers/Project/Interface/InterfaceCol/InterfaceColContent.js index e21e1c6e..5a8119cb 100755 --- a/client/containers/Project/Interface/InterfaceCol/InterfaceColContent.js +++ b/client/containers/Project/Interface/InterfaceCol/InterfaceColContent.js @@ -544,7 +544,7 @@ class InterfaceColContent extends Component { {' '} 每个用例都有唯一的key,用于获取所匹配接口的响应数据,例如使用{' '} diff --git a/common/postmanLib.js b/common/postmanLib.js index 2e3a6d54..bcb66f8b 100644 --- a/common/postmanLib.js +++ b/common/postmanLib.js @@ -203,7 +203,6 @@ async function crossRequest(defaultOptions, preScript, afterScript) { let urlObj = URL.parse(options.url, true), query = {}; query = Object.assign(query, urlObj.query); - let context = { get href() { return urlObj.href; @@ -217,6 +216,15 @@ async function crossRequest(defaultOptions, preScript, afterScript) { set hostname(val){ throw new Error('context.hostname 不能被赋值') }, + + get caseId() { + return options.caseId; + }, + + set caseId(val){ + throw new Error('context.caseId 不能被赋值') + }, + method: options.method, pathname: urlObj.pathname, query: query, @@ -318,7 +326,7 @@ function handleParams(interfaceData, handleValue, requestParams) { return obj; } - let { case_env, path, env } = interfaceData; + let { case_env, path, env, _id } = interfaceData; let currDomain, requestBody, requestOptions = {}; @@ -342,8 +350,10 @@ function handleParams(interfaceData, handleValue, requestParams) { query: Object.assign(urlObj.query, paramsToObjectWithEnable(interfaceData.req_query)) }); + requestOptions = { url, + caseId: _id, method: interfaceData.method, headers: paramsToObjectUnWithEnable(interfaceData.req_headers), timeout: 82400000 diff --git a/docs/documents/project.md b/docs/documents/project.md index a7f926d3..70048862 100755 --- a/docs/documents/project.md +++ b/docs/documents/project.md @@ -138,7 +138,8 @@ context = { context.responseBody.a = 2; ``` -> (v1.3.16+新增)context.href和context.hostname +> (v1.3.16+新增)context.href和context.hostname +> (v1.3.17+新增)context.caseId 测试用例的唯一 key 值 ### 工具函数 ``` context.utils = { diff --git a/static/doc/documents/CHANGELOG.html b/static/doc/documents/CHANGELOG.html index 03b29ccc..90c3fbda 100644 --- a/static/doc/documents/CHANGELOG.html +++ b/static/doc/documents/CHANGELOG.html @@ -7,7 +7,18 @@
-

v1.3.16

+

v1.3.17

+ +

Bug Fixed

+ +

v1.3.16