Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-03-21 20:44:39 +08:00
commit bccc68b841
12 changed files with 95 additions and 5 deletions

View File

@ -193,6 +193,8 @@ public class ApiDefinitionExecResultService {
planRequest.setScenarioId(item.getTestCaseID()); planRequest.setScenarioId(item.getTestCaseID());
} else if ("apiCase".equals(item.getCaseType())) { } else if ("apiCase".equals(item.getCaseType())) {
planRequest.setApiId(item.getTestCaseID()); planRequest.setApiId(item.getTestCaseID());
} else if ("load".equals(item.getCaseType())) {
planRequest.setLoadId(item.getTestCaseID());
} }
List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest); List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest);
item.setTestPlanDTOList(dtoList); item.setTestPlanDTOList(dtoList);

View File

@ -63,6 +63,18 @@
WHERE report.project_id = #{projectId} WHERE report.project_id = #{projectId}
AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp} AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp}
GROUP BY scene.id GROUP BY scene.id
UNION
SELECT ltr.test_id as testCaseID, ltr.name as caseName,tplt.testPlanName AS testPlan, count(ltr.id) as failureTimes, 'load' as caseType FROM load_test_report ltr
join load_test on load_test.id = ltr.test_id
JOIN (
select tplc.load_case_id, group_concat(tp.`name`) AS testPlanName, tp.project_id
from test_plan_load_case tplc
join test_plan tp on tp.id = tplc.test_plan_id
GROUP BY tplc.load_case_id
) tplt on tplt.load_case_id = ltr.test_id
WHERE load_test.project_id = #{projectId}
AND ltr.STATUS = 'Error' and ltr.trigger_mode = 'TEST_PLAN_SCHEDULE' AND ltr.create_time >= #{startTimestamp}
GROUP BY load_test.id
) showTable ) showTable
ORDER BY showTable.failureTimes DESC ORDER BY showTable.failureTimes DESC
</select> </select>

View File

@ -223,6 +223,9 @@
<if test="request.apiId != null"> <if test="request.apiId != null">
AND p.id IN (SELECT test_plan_id FROM test_plan_api_case WHERE api_case_id = #{request.apiId}) AND p.id IN (SELECT test_plan_id FROM test_plan_api_case WHERE api_case_id = #{request.apiId})
</if> </if>
<if test="request.loadId != null">
AND p.id IN (SELECT test_plan_id FROM test_plan_load_case WHERE load_case_id = #{request.loadId})
</if>
</where> </where>
</select> </select>
<select id="findTestProjectNameByTestPlanID" resultType="java.lang.String"> <select id="findTestProjectNameByTestPlanID" resultType="java.lang.String">

View File

@ -1,6 +1,7 @@
package io.metersphere.track.issue; package io.metersphere.track.issue;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.constants.IssuesManagePlatform;
@ -81,7 +82,55 @@ public class JiraPlatform extends AbstractIssuePlatform {
@Override @Override
public List<DemandDTO> getDemandList(String projectId) { public List<DemandDTO> getDemandList(String projectId) {
return null; List<DemandDTO> list = new ArrayList<>();
try {
String key = this.getProjectId(projectId);
if (StringUtils.isBlank(key)) {
MSException.throwException("未关联Jira 项目Key");
}
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
JSONObject object = JSON.parseObject(config);
if (object == null) {
MSException.throwException("jira config is null");
}
String account = object.getString("account");
String password = object.getString("password");
String url = object.getString("url");
String type = object.getString("storytype");
String auth = EncryptUtils.base64Encoding(account + ":" + password);
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.add("Authorization", "Basic " + auth);
requestHeaders.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);
//HttpEntity
HttpEntity<String> requestEntity = new HttpEntity<>(requestHeaders);
RestTemplate restTemplate = new RestTemplate();
//post
ResponseEntity<String> responseEntity = null;
responseEntity = restTemplate.exchange(url + "/rest/api/2/search?jql=project="+key+"+AND+issuetype="+type+"&fields=summary,issuetype",
HttpMethod.GET, requestEntity, String.class);
String body = responseEntity.getBody();
JSONObject jsonObject = JSONObject.parseObject(body);
JSONArray jsonArray = jsonObject.getJSONArray("issues");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject o = jsonArray.getJSONObject(i);
String issueKey = o.getString("key");
JSONObject fields = o.getJSONObject("fields");
String summary = fields.getString("summary");
DemandDTO demandDTO = new DemandDTO();
demandDTO.setName(summary);
demandDTO.setId(issueKey);
demandDTO.setPlatform(IssuesManagePlatform.Jira.name());
list.add(demandDTO);
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
MSException.throwException("调用Jira查询需求失败");
}
return list;
} }
@Override @Override

View File

@ -20,6 +20,8 @@ public class QueryTestPlanRequest extends TestPlan {
private String apiId; private String apiId;
private String loadId;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;

View File

@ -23,6 +23,7 @@
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-tag v-if="scope.row.caseType == 'apiCase'" type="success" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"/> <ms-tag v-if="scope.row.caseType == 'apiCase'" type="success" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"/>
<ms-tag v-if="scope.row.caseType == 'scenario'" type="warning" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"/> <ms-tag v-if="scope.row.caseType == 'scenario'" type="warning" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"/>
<ms-tag v-if="scope.row.caseType == 'load'" type="danger" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.load')"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')"> <el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')">

View File

@ -16,6 +16,9 @@
<el-form-item :label="$t('organization.integration.jira_issuetype')" prop="issuetype"> <el-form-item :label="$t('organization.integration.jira_issuetype')" prop="issuetype">
<el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/> <el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('organization.integration.jira_storytype')" prop="storytype">
<el-input v-model="form.storytype" :placeholder="$t('organization.integration.input_jira_storytype')"/>
</el-form-item>
</el-form> </el-form>
</div> </div>
@ -79,6 +82,11 @@ export default {
required: true, required: true,
message: this.$t('organization.integration.input_jira_issuetype'), message: this.$t('organization.integration.input_jira_issuetype'),
trigger: ['change', 'blur'] trigger: ['change', 'blur']
},
storytype: {
required: true,
message: this.$t('organization.integration.input_jira_storytype'),
trigger: ['change', 'blur']
} }
}, },
} }
@ -97,6 +105,7 @@ export default {
this.$set(this.form, 'password', config.password); this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url); this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype); this.$set(this.form, 'issuetype', config.issuetype);
this.$set(this.form, 'storytype', config.storytype);
} else { } else {
this.clear(); this.clear();
} }
@ -114,7 +123,8 @@ export default {
account: this.form.account, account: this.form.account,
password: this.form.password, password: this.form.password,
url: formatUrl, url: formatUrl,
issuetype: this.form.issuetype issuetype: this.form.issuetype,
storytype: this.form.storytype
}; };
const {lastOrganizationId} = getCurrentUser(); const {lastOrganizationId} = getCurrentUser();
param.organizationId = lastOrganizationId; param.organizationId = lastOrganizationId;
@ -139,6 +149,7 @@ export default {
this.$set(this.form, 'password', ''); this.$set(this.form, 'password', '');
this.$set(this.form, 'url', ''); this.$set(this.form, 'url', '');
this.$set(this.form, 'issuetype', ''); this.$set(this.form, 'issuetype', '');
this.$set(this.form, 'storytype', '');
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
}); });

View File

@ -775,6 +775,7 @@ export default {
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'}) this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'})
this.result = {loading : false}; this.result = {loading : false};
}).catch(() => { }).catch(() => {
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'})
this.result = {loading : false}; this.result = {loading : false};
}) })
} }

@ -1 +1 @@
Subproject commit 06b31ddd4f2542cb86bf3e31a1a8f624742a2193 Subproject commit f13fe5c9e5fe0bc527503c70d735163ea7e60665

View File

@ -314,11 +314,13 @@ export default {
account: 'Account', account: 'Account',
password: 'Password', password: 'Password',
jira_url: 'JIRA url', jira_url: 'JIRA url',
jira_issuetype: 'JIRA issuetype', jira_issuetype: 'JIRA issue type',
jira_storytype: 'JIRA story type',
input_api_account: 'please enter account', input_api_account: 'please enter account',
input_api_password: 'Please enter password', input_api_password: 'Please enter password',
input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/', input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/',
input_jira_issuetype: 'Please enter the question type', input_jira_issuetype: 'Please enter the issue type',
input_jira_storytype: 'Please enter the story type',
zentao_url: 'Zentao url', zentao_url: 'Zentao url',
input_zentao_url: 'Please enter Zentao address, for example: http://xx.xx.xx.xx/zentao/', input_zentao_url: 'Please enter Zentao address, for example: http://xx.xx.xx.xx/zentao/',
use_tip: 'Usage guidelines:', use_tip: 'Usage guidelines:',
@ -1033,6 +1035,7 @@ export default {
case_type: { case_type: {
api: "Api case", api: "Api case",
scene: "Scenario case", scene: "Scenario case",
load: "Load case"
} }
} }
}, },

View File

@ -313,10 +313,12 @@ export default {
password: '密码', password: '密码',
jira_url: 'JIRA 地址', jira_url: 'JIRA 地址',
jira_issuetype: '问题类型', jira_issuetype: '问题类型',
jira_storytype: '需求类型',
input_api_account: '请输入账号', input_api_account: '请输入账号',
input_api_password: '请输入密码', input_api_password: '请输入密码',
input_jira_url: '请输入Jira地址https://metersphere.atlassian.net/', input_jira_url: '请输入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '请输入问题类型', input_jira_issuetype: '请输入问题类型',
input_jira_storytype: '请输入需求类型',
zentao_url: 'Zentao 地址', zentao_url: 'Zentao 地址',
input_zentao_url: '请输入Zentao地址http://xx.xx.xx.xx/zentao/', input_zentao_url: '请输入Zentao地址http://xx.xx.xx.xx/zentao/',
use_tip: '使用指引:', use_tip: '使用指引:',
@ -1037,6 +1039,7 @@ export default {
case_type: { case_type: {
api: "接口用例", api: "接口用例",
scene: "场景用例", scene: "场景用例",
load: "性能用例"
} }
} }
}, },

View File

@ -313,10 +313,12 @@ export default {
password: '密碼', password: '密碼',
jira_url: 'JIRA 地址', jira_url: 'JIRA 地址',
jira_issuetype: '問題類型', jira_issuetype: '問題類型',
jira_storytype: '需求類型',
input_api_account: '請輸入賬號', input_api_account: '請輸入賬號',
input_api_password: '請輸入密碼', input_api_password: '請輸入密碼',
input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/', input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '請輸入問題類型', input_jira_issuetype: '請輸入問題類型',
input_jira_storytype: '請輸入需求類型',
zentao_url: 'Zentao 地址', zentao_url: 'Zentao 地址',
input_zentao_url: '請輸入Zentao地址http://xx.xx.xx.xx/zentao/', input_zentao_url: '請輸入Zentao地址http://xx.xx.xx.xx/zentao/',
use_tip: '使用指引:', use_tip: '使用指引:',
@ -1035,6 +1037,7 @@ export default {
case_type: { case_type: {
api: "接口用例", api: "接口用例",
scene: "場景用例", scene: "場景用例",
load: "性能用例"
} }
} }
}, },