fix(接口测试): 导入jmeter格式接口定义后带有多余步骤

--bug=1009808 --user=lyh 【接口测试】接口定义,导入jmeter格式接口定义,看不到用例
https://www.tapd.cn/55049933/s/1097297
This commit is contained in:
shiziyuan9527 2022-01-24 15:19:06 +08:00 committed by shiziyuan9527
parent 92701822ea
commit c0d70697dc
1 changed files with 4 additions and 1 deletions

View File

@ -104,13 +104,16 @@ public class JmeterDefinitionParser extends ApiImportAbstractParser<ApiDefinitio
for (MsTestElement element : results) { for (MsTestElement element : results) {
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = buildApiDefinition(element); ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = buildApiDefinition(element);
if (apiDefinitionWithBLOBs != null) { if (apiDefinitionWithBLOBs != null) {
definitions.add(apiDefinitionWithBLOBs);
ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs(); ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs();
BeanUtils.copyBean(apiTestCase, apiDefinitionWithBLOBs); BeanUtils.copyBean(apiTestCase, apiDefinitionWithBLOBs);
apiTestCase.setApiDefinitionId(apiDefinitionWithBLOBs.getId()); apiTestCase.setApiDefinitionId(apiDefinitionWithBLOBs.getId());
apiTestCase.setStatus("Prepare"); apiTestCase.setStatus("Prepare");
apiTestCase.setPriority("P0"); apiTestCase.setPriority("P0");
definitionCases.add(apiTestCase); definitionCases.add(apiTestCase);
element.getHashTree().clear();
apiDefinitionWithBLOBs.setRequest(JSON.toJSONString(element));
definitions.add(apiDefinitionWithBLOBs);
} }
} }
apiImport.setData(definitions); apiImport.setData(definitions);