fix(接口测试): 修复接口测试报告中接口用例触发方式识别不出jenkins执行的问题

修复接口测试报告中接口用例触发方式识别不出jenkins执行的问题
This commit is contained in:
song-tianyang 2022-09-26 16:24:54 +08:00 committed by 建国
parent f066d9c5ca
commit 0c7e0b0adf
2 changed files with 29 additions and 11 deletions

View File

@ -518,6 +518,7 @@ public class ApiDefinitionExecResultService {
public List<ApiDefinitionExecResultExpand> apiReportList(QueryAPIReportRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders(), "end_time"));
this.initReportRequest(request);
List<ApiDefinitionExecResultExpand> list = extApiDefinitionExecResultMapper.list(request);
List<String> userIds = list.stream().map(ApiDefinitionExecResult::getUserId)
.collect(Collectors.toList());
@ -545,4 +546,20 @@ public class ApiDefinitionExecResultService {
apiDefinitionExecResultMapper.deleteByExample(apiDefinitionExecResultExample);
}
}
private void initReportRequest(QueryAPIReportRequest request) {
if (request != null) {
if (MapUtils.isNotEmpty(request.getFilters()) && request.getFilters().containsKey("trigger_mode")) {
boolean filterHasApi = false;
for (String triggerMode : request.getFilters().get("trigger_mode")) {
if (StringUtils.equalsIgnoreCase(triggerMode, "api")) {
filterHasApi = true;
}
}
if (filterHasApi) {
request.getFilters().get("trigger_mode").add("JENKINS");
}
}
}
}
}

View File

@ -1,21 +1,22 @@
<template>
<span>
<span v-if="triggerMode === 'MANUAL'">{{$t('commons.trigger_mode.manual')}}</span>
<span v-if="triggerMode === 'SCHEDULE'">{{$t('commons.trigger_mode.schedule')}}</span>
<span v-if="triggerMode === 'TEST_PLAN_SCHEDULE'">{{$t('commons.trigger_mode.test_plan_schedule')}}</span>
<span v-if="triggerMode === 'TEST_PLAN_API'">{{$t('commons.trigger_mode.test_plan_api')}}</span>
<span v-if="triggerMode === 'API'">{{$t('commons.trigger_mode.api')}}</span>
<span v-if="triggerMode === 'JENKINS_RUN_TEST_PLAN'">{{$t('commons.trigger_mode.api')}}</span>
<span v-if="triggerMode === 'BATCH'">{{$t('api_test.automation.batch_execute')}}</span>
<span v-if="triggerMode === 'MANUAL'">{{ $t('commons.trigger_mode.manual') }}</span>
<span v-if="triggerMode === 'SCHEDULE'">{{ $t('commons.trigger_mode.schedule') }}</span>
<span v-if="triggerMode === 'TEST_PLAN_SCHEDULE'">{{ $t('commons.trigger_mode.test_plan_schedule') }}</span>
<span v-if="triggerMode === 'TEST_PLAN_API'">{{ $t('commons.trigger_mode.test_plan_api') }}</span>
<span v-if="triggerMode === 'API'">{{ $t('commons.trigger_mode.api') }}</span>
<span v-if="triggerMode === 'JENKINS'">{{ $t('commons.trigger_mode.api') }}</span>
<span v-if="triggerMode === 'JENKINS_RUN_TEST_PLAN'">{{ $t('commons.trigger_mode.api') }}</span>
<span v-if="triggerMode === 'BATCH'">{{ $t('api_test.automation.batch_execute') }}</span>
</span>
</template>
<script>
export default {
name: "ReportTriggerModeItem",
props: ['triggerMode']
}
export default {
name: "ReportTriggerModeItem",
props: ['triggerMode']
}
</script>
<style scoped>