fix(接口测试): 解决导入场景补充case不能执行的问题

--id=1011678
--user=郭雨琦
【接口测试】导入的场景,自动创建了接口定义,在场景里选mock环境,执行,没有返回api定义的响应体
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001011678
This commit is contained in:
guoyuqi 2022-03-31 17:51:11 +08:00 committed by 刘瑞斌
parent fdd9c08477
commit 2a730f6f7d
1 changed files with 8 additions and 2 deletions

View File

@ -193,7 +193,10 @@ public class ApiScenarioImportUtil {
object.put("resourceId", test.getId());
object.put("projectId", projectId);
object.put("useEnvironment","");
test.setRequest(object.toJSONString());
JSONObject objectNew = JSONObject.parseObject(object.toJSONString());
objectNew.remove("refType");
objectNew.remove("referenced");
test.setRequest(objectNew.toJSONString());
test.setUserId(SessionUtils.getUserId());
test.setLatest(true);
test.setOrder(apiDefinitionService.getImportNextOrder(projectId));
@ -223,7 +226,10 @@ public class ApiScenarioImportUtil {
object.put("resourceId", apiTestCase.getId());
object.put("projectId", projectId);
object.put("useEnvironment","");
apiTestCase.setRequest(object.toJSONString());
JSONObject objectNew = JSONObject.parseObject(object.toJSONString());
objectNew.remove("refType");
objectNew.remove("referenced");
apiTestCase.setRequest(objectNew.toJSONString());
apiTestCase.setOrder(apiDefinitionService.getImportNextCaseOrder(projectId));
apiTestCaseMapper.insert(apiTestCase);
}