fix(接口测试): 修复接口用例列表批量执行因为开启误报库产生的错误

修复接口用例列表批量执行因为开启误报库产生的错误
This commit is contained in:
song-tianyang 2022-03-04 17:13:54 +08:00 committed by fit2-zhao
parent 4ffa303d43
commit ae4ccc0e4d
4 changed files with 14 additions and 10 deletions

View File

@ -76,10 +76,16 @@ public class ElementUtil {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class); ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId); ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
if (environment != null && environment.getConfig() != null) { if (environment != null && environment.getConfig() != null) {
if(StringUtils.isEmpty(projectId)){
projectId = environment.getProjectId();
}
if (StringUtils.equals(environment.getName(), MockConfigStaticData.MOCK_EVN_NAME)) { if (StringUtils.equals(environment.getName(), MockConfigStaticData.MOCK_EVN_NAME)) {
isMockEnvironment = true; isMockEnvironment = true;
} }
// 单独接口执行 // 单独接口执行
if (StringUtils.isEmpty(projectId)) {
projectId = environment.getProjectId();
}
Map<String, EnvironmentConfig> map = new HashMap<>(); Map<String, EnvironmentConfig> map = new HashMap<>();
map.put(projectId, JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class)); map.put(projectId, JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class));
return map; return map;

View File

@ -167,8 +167,12 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setDoMultipart(this.isDoMultipartPost()); sampler.setDoMultipart(this.isDoMultipartPost());
if (config.getConfig() == null) { if (config.getConfig() == null) {
// 单独接口执行 // 单独接口执行
this.setProjectId(config.getProjectId()); if (StringUtils.isNotEmpty(config.getProjectId())) {
config.setConfig(ElementUtil.getEnvironmentConfig(this.useEnvironment, this.getProjectId(), this.isMockEnvironment())); this.setProjectId(config.getProjectId());
}
String projectId = this.getProjectId();
config.setConfig(ElementUtil.getEnvironmentConfig(this.useEnvironment, projectId, this.isMockEnvironment()));
this.setProjectId(projectId);
} }
config.compatible(this); config.compatible(this);

View File

@ -1822,12 +1822,12 @@ public class ApiAutomationService {
List<String> scenarioNames = extApiScenarioMapper.selectNameByIdIn(scenarioIdList); List<String> scenarioNames = extApiScenarioMapper.selectNameByIdIn(scenarioIdList);
if (StringUtils.isNotEmpty(deleteScenarioName) && CollectionUtils.isNotEmpty(scenarioNames)) { if (StringUtils.isNotEmpty(deleteScenarioName) && CollectionUtils.isNotEmpty(scenarioNames)) {
String nameListStr = "["; String nameListStr = " ";
for (String name : scenarioNames) { for (String name : scenarioNames) {
nameListStr += name + ","; nameListStr += name + ",";
} }
if (nameListStr.length() > 1) { if (nameListStr.length() > 1) {
nameListStr = nameListStr.substring(0, nameListStr.length() - 1) + "]"; nameListStr = nameListStr.substring(0, nameListStr.length() - 1) + " ";
} }
String msg = deleteScenarioName + " " + Translator.get("delete_check_reference_by") + ": " + nameListStr + " "; String msg = deleteScenarioName + " " + Translator.get("delete_check_reference_by") + ": " + nameListStr + " ";
checkMsgList.add(msg); checkMsgList.add(msg);

View File

@ -203,9 +203,6 @@
${order.name} ${order.type} ${order.name} ${order.type}
</foreach> </foreach>
</if> </if>
<if test="request.limit != null">
${request.limit}
</if>
</where> </where>
) apiScenarioReport ) apiScenarioReport
union union
@ -272,9 +269,6 @@
${order.name} ${order.type} ${order.name} ${order.type}
</foreach> </foreach>
</if> </if>
<if test="request.limit != null">
${request.limit}
</if>
) apiDefinitionReport ) apiDefinitionReport
) r ) r
<if test="request.orders != null and request.orders.size() > 0"> <if test="request.orders != null and request.orders.size() > 0">