fix(报表功能、接口测试): #1006723 #1006753 #1006751 #1006773 报表提供图片下载功能、修复json-schema解析出错以及添加前后置脚本异常的问题

--bug=1006723 --user=宋天阳 【报表统计】测试用例统计下载为png和jpeg功能没有
https://www.tapd.cn/55049933/s/1048824;--bug=1006753 --user=宋天阳
【接口定义】jsonschema-高级设置-枚举-自动生成数据-另存为接口用例-执行,响应结果的请求体数据不对
https://www.tapd.cn/55049933/s/1048819;--bug=1006751 --user=宋天阳
【接口测试】正常执行测试用例,控制台有报错
https://www.tapd.cn/55049933/s/1048820;--bug=1006773 --user=宋天阳
【接口测试-接口自动化】全局后置脚本添加后控制台提示异常 https://www.tapd.cn/55049933/s/1048822
This commit is contained in:
song-tianyang 2021-09-21 11:26:39 +08:00 committed by 刘瑞斌
parent 80f7475248
commit 22f0211aa4
7 changed files with 31 additions and 15 deletions

View File

@ -295,7 +295,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
private void setScript(HttpConfig httpConfig, HashTree httpSamplerTree, ParameterConfig config) {
MsJSR223PreProcessor preProcessor = httpConfig.getPreProcessor();
MsJSR223PostProcessor postProcessor = httpConfig.getPostProcessor();
if (preProcessor != null) {
if (preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
if (preProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
preProcessor.setEnvironmentId(useEnvironment);
@ -305,7 +305,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
preProcessor.toHashTree(httpSamplerTree, preProcessor.getHashTree(), config);
}
if (postProcessor != null) {
if (postProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
if (postProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
postProcessor.setEnvironmentId(useEnvironment);

View File

@ -221,8 +221,16 @@ public class JSONSchemaGenerator {
JsonObject itemsObject = jsonArray.get(i).getAsJsonObject();
if (object.has("items")) {
if (itemsObject.has("enum")) {
array.add(analyzeEnumProperty(itemsObject));
if (itemsObject.has("mock") && itemsObject.get("mock").getAsJsonObject() != null && StringUtils.isNotEmpty(itemsObject.get("mock").getAsJsonObject().get("mock").getAsString())) {
try {
int value = itemsObject.get("mock").getAsJsonObject().get("mock").getAsInt();
array.add(value);
} catch (Exception e) {
String value = ScriptEngineUtils.buildFunctionCallString(itemsObject.get("mock").getAsJsonObject().get("mock").getAsString());
array.add(value);
}
}else if (itemsObject.has("enum")) {
// array.add(analyzeEnumProperty(itemsObject));
} else if (itemsObject.has("type") && itemsObject.get("type").getAsString().equals("string")) {
if (itemsObject.has("default")) {
array.add(itemsObject.get("default"));

View File

@ -10,13 +10,6 @@
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.definition.request.pre_script')" name="prescript">
<jsr233-processor-content v-if="isRefresh"
:jsr223-processor="environment.config.preProcessor"
:is-pre-processor="true"
:is-read-only="isReadOnly"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.environment.common_config')" name="common">
<ms-environment-common-config :common-config="environment.config.commonConfig" ref="commonConfig" :is-read-only="isReadOnly"/>
</el-tab-pane>
@ -33,16 +26,22 @@
<el-tab-pane :label="$t('commons.ssl.config')" name="ssl">
<ms-environment-s-s-l-config :project-id="projectId" :ssl-config="environment.config.sslConfig" :is-read-only="isReadOnly"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.post_script')" name="postscript">
<el-tab-pane :label="$t('api_test.definition.request.all_pre_script')" name="prescript">
<jsr233-processor-content v-if="isRefresh"
:jsr223-processor="environment.config.preProcessor"
:is-pre-processor="true"
:is-read-only="isReadOnly"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.all_post_script')" name="postscript">
<jsr233-processor-content v-if="isRefresh"
:jsr223-processor="environment.config.postProcessor"
:is-pre-processor="false"
:is-read-only="false"/>
</el-tab-pane>
<!-- 认证配置 -->
<el-tab-pane :label="$t('api_test.definition.request.auth_config')" name="authConfig" v-if="isRefresh">
<el-tab-pane :label="$t('api_test.definition.request.all_auth_config')" name="authConfig" v-if="isRefresh">
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.auth_config_info')" placement="top-start" slot="label">
<span>{{$t('api_test.definition.request.auth_config')}}</span>
<span>{{$t('api_test.definition.request.all_auth_config')}}</span>
</el-tooltip>
<ms-api-auth-config :is-read-only="isReadOnly" :request="environment.config.authManager"/>
</el-tab-pane>

@ -1 +1 @@
Subproject commit a6571580d55ede6ab3e02d368ee32bd769e07db2
Subproject commit 183d61c23620452e3fe0ba56574adf5ce45207a7

View File

@ -889,6 +889,7 @@ export default {
body_json: "json",
body_xml: "xml",
auth_config: "Authentication configuration",
all_auth_config: "Authentication configuration",
rest_param: "Rest parameter",
query_param: "Query parameter",
verification_method: "Verification method",
@ -913,7 +914,9 @@ export default {
rest_info: "Slash/separated parameters in the address bar, such as updateapi/{id}",
auth_config_info: "Request requires permission verification",
pre_script: "Prescript",
all_pre_script: "Prescript",
post_script: "Postscript",
all_post_script: "Postscript",
pre_sql: "JDBC Preprocessor",
post_sql: "JDBC Postprocessor",
extract_param: "Extract parameters",

View File

@ -895,6 +895,7 @@ export default {
body_json: "json",
body_xml: "xml",
auth_config: "认证配置",
all_auth_config: "全局认证配置",
rest_param: "REST参数",
query_param: "QUERY参数",
verification_method: "认证方式",
@ -919,7 +920,9 @@ export default {
rest_info: "地址栏中被斜杠/分隔的参数如updateapi/{id}",
auth_config_info: "请求需要进行权限校验",
pre_script: "前置脚本",
all_pre_script: "全局前置脚本",
post_script: "后置脚本",
all_post_script: "全局后置脚本",
pre_sql: "前置SQL",
post_sql: "后置SQL",
extract_param: "提取参数",

View File

@ -895,6 +895,7 @@ export default {
body_json: "json",
body_xml: "xml",
auth_config: "認證配置",
all_auth_config: "全局認證配置",
rest_param: "REST參數",
query_param: "QUERY參數",
verification_method: "認證方式",
@ -919,7 +920,9 @@ export default {
rest_info: "地址欄中被斜杠/分隔的參數如updateapi/{id}",
auth_config_info: "請求需要進行權限校驗",
pre_script: "前置腳本",
all_pre_script: "全局前置腳本",
post_script: "後置腳本",
all_post_script: "全局後置腳本",
pre_sql: "前置SQL",
post_sql: "後置SQL",
extract_param: "提取參數",