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);
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
if (environment != null && environment.getConfig() != null) {
if(StringUtils.isEmpty(projectId)){
projectId = environment.getProjectId();
}
if (StringUtils.equals(environment.getName(), MockConfigStaticData.MOCK_EVN_NAME)) {
isMockEnvironment = true;
}
// 单独接口执行
if (StringUtils.isEmpty(projectId)) {
projectId = environment.getProjectId();
}
Map<String, EnvironmentConfig> map = new HashMap<>();
map.put(projectId, JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class));
return map;

View File

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

View File

@ -1822,12 +1822,12 @@ public class ApiAutomationService {
List<String> scenarioNames = extApiScenarioMapper.selectNameByIdIn(scenarioIdList);
if (StringUtils.isNotEmpty(deleteScenarioName) && CollectionUtils.isNotEmpty(scenarioNames)) {
String nameListStr = "[";
String nameListStr = " ";
for (String name : scenarioNames) {
nameListStr += name + ",";
}
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 + " ";
checkMsgList.add(msg);

View File

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