Merge branch 'v1.6' of https://github.com/metersphere/metersphere into v1.6
This commit is contained in:
commit
c62adcfc32
|
@ -103,4 +103,8 @@ public class ApiTestCaseController {
|
|||
public String jenkinsRun(@RequestBody RunCaseRequest request) {
|
||||
return apiTestCaseService.run(request);
|
||||
}
|
||||
@GetMapping(value = "/jenkins/exec/result/{id}")
|
||||
public String getExecResult(@PathVariable String id) {
|
||||
return apiTestCaseService.getExecResult(id);
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import io.metersphere.api.dto.definition.request.MsThreadGroup;
|
|||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ApiDefinitionMapper;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.base.mapper.ApiTestFileMapper;
|
||||
|
@ -68,6 +69,8 @@ public class ApiTestCaseService {
|
|||
private ApiDefinitionMapper apiDefinitionMapper;
|
||||
@Resource
|
||||
private JMeterService jMeterService;
|
||||
@Resource
|
||||
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
|
||||
|
||||
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
|
||||
|
||||
|
@ -406,6 +409,7 @@ public class ApiTestCaseService {
|
|||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsTestElement element = mapper.readValue(testCaseWithBLOBs.getRequest(), new TypeReference<MsTestElement>() {
|
||||
});
|
||||
element.setName(request.getCaseId());
|
||||
// 测试计划
|
||||
MsTestPlan testPlan = new MsTestPlan();
|
||||
testPlan.setHashTree(new LinkedList<>());
|
||||
|
@ -434,4 +438,11 @@ public class ApiTestCaseService {
|
|||
return request.getReportId();
|
||||
}
|
||||
|
||||
public String getExecResult(String id){
|
||||
ApiDefinitionExecResultExample apidefinitionexecresultexample = new ApiDefinitionExecResultExample();
|
||||
ApiDefinitionExecResultExample.Criteria criteria = apidefinitionexecresultexample.createCriteria();
|
||||
criteria.andResourceIdEqualTo(id);
|
||||
String status=apiDefinitionExecResultMapper.selectByExample(apidefinitionexecresultexample).get(0).getStatus();
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,12 +195,6 @@
|
|||
AND atc.api_definition_id = #{request.apiDefinitionId}
|
||||
</if>
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
atc.${order.name} ${order.type}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
|
||||
|
|
|
@ -320,21 +320,28 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="listByMethod" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||
SELECT id,name,status,project_id,"api" as type from api_test
|
||||
SELECT id,name,project_id,"api" as type from api_test
|
||||
<where>
|
||||
<if test="request.projectId!=null">
|
||||
and project_id=#{request.projectId}
|
||||
</if>
|
||||
</where>
|
||||
UNION ALL
|
||||
select id,name,status,project_id,"perform" as type from load_test
|
||||
select id,name,project_id,"perform" as type from load_test
|
||||
<where>
|
||||
<if test="request.projectId!=null">
|
||||
and project_id= #{request.projectId}
|
||||
</if>
|
||||
</where>
|
||||
UNION ALL
|
||||
select id,name,status,project_id,"scenario" as type from api_scenario
|
||||
select id,name,project_id,"scenario" as type from api_scenario
|
||||
<where>
|
||||
<if test="request.projectId!=null">
|
||||
and project_id= #{request.projectId}
|
||||
</if>
|
||||
</where>
|
||||
UNION ALL
|
||||
select id,name,project_id,"definition" as type from api_test_case
|
||||
<where>
|
||||
<if test="request.projectId!=null">
|
||||
and project_id= #{request.projectId}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
from
|
||||
test_plan_api_case t
|
||||
inner join
|
||||
api_test_case c
|
||||
api_test_case c
|
||||
on t.api_case_id = c.id
|
||||
<if test="request.planId != null and request.planId!=''">
|
||||
and t.test_plan_id = #{request.planId}
|
||||
|
|
|
@ -106,18 +106,18 @@
|
|||
resultType="io.metersphere.track.dto.TestCaseReportStatusResultDTO">
|
||||
select count(t1.id) as `count`, t1.status
|
||||
from test_plan_test_case t1
|
||||
inner join test_case t2
|
||||
inner join test_case t2
|
||||
where t1.case_id = t2.id
|
||||
and plan_id = #{planId}
|
||||
and plan_id = #{planId}
|
||||
group by t1.status;
|
||||
</select>
|
||||
|
||||
<select id="getExecutors" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select distinct t1.executor
|
||||
from test_plan_test_case t1
|
||||
inner join test_case t2
|
||||
inner join test_case t2
|
||||
where t1.case_id = t2.id
|
||||
and plan_id = #{planId};
|
||||
and plan_id = #{planId};
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||
|
@ -320,31 +320,46 @@
|
|||
</select>
|
||||
|
||||
<select id="get" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName
|
||||
select test_case.remark,
|
||||
test_plan_test_case.id as id,
|
||||
test_plan_test_case.*,
|
||||
test_case.*,
|
||||
test_case_node.name as model,
|
||||
project.name as projectName
|
||||
from test_plan_test_case
|
||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||
left join test_case_node on test_case_node.id=test_case.node_id
|
||||
inner join project on project.id = test_case.project_id
|
||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||
left join test_case_node on test_case_node.id = test_case.node_id
|
||||
inner join project on project.id = test_case.project_id
|
||||
where test_plan_test_case.id = #{testPlanTestCaseId}
|
||||
</select>
|
||||
|
||||
<select id="getExecResultByPlanId" resultType="java.lang.String">
|
||||
select status
|
||||
from
|
||||
test_plan_test_case
|
||||
where plan_id = #{planId}
|
||||
select status
|
||||
from test_plan_test_case
|
||||
where plan_id = #{planId}
|
||||
</select>
|
||||
<select id="listByPlanId" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||
SELECT test_plan_api_case.api_case_id as id,"definition" as type,api_test_case.name,test_plan_api_case.status
|
||||
from test_plan_api_case left join api_test_case on test_plan_api_case.api_case_id=api_test_case.id
|
||||
from test_plan_api_case left join api_test_case on test_plan_api_case.api_case_id=api_test_case.id
|
||||
inner join
|
||||
api_definition a
|
||||
on
|
||||
api_test_case.api_definition_id = a.id
|
||||
and a.status != 'Trash'
|
||||
<where>
|
||||
<if test="request.planId != null">
|
||||
and test_plan_api_case.test_plan_id = #{request.planId}
|
||||
</if>
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT test_plan_api_scenario.api_scenario_id as id,"scenario" as type,api_scenario.name,test_plan_api_scenario.status
|
||||
from test_plan_api_scenario left join api_scenario on test_plan_api_scenario.api_scenario_id=api_scenario.id
|
||||
SELECT test_plan_api_scenario.api_scenario_id as id,"scenario" as
|
||||
type,api_scenario.name,test_plan_api_scenario.status
|
||||
from test_plan_api_scenario
|
||||
left join
|
||||
api_scenario
|
||||
on
|
||||
test_plan_api_scenario.api_scenario_id=api_scenario.id
|
||||
and api_scenario.status != 'Trash'
|
||||
<where>
|
||||
<if test="request.planId != null">
|
||||
and test_plan_api_scenario.test_plan_id = #{request.planId}
|
||||
|
@ -352,7 +367,7 @@
|
|||
</where>
|
||||
UNION ALL
|
||||
SELECT test_case.test_id as id,test_case.type as type,test_case.name,test_plan_test_case.status
|
||||
from test_plan_test_case left join test_case on test_plan_test_case.case_id =test_case.id
|
||||
from test_plan_test_case left join test_case on test_plan_test_case.case_id =test_case.id
|
||||
<where>
|
||||
<if test="request.planId != null">
|
||||
and test_plan_test_case.plan_id = #{request.planId}
|
||||
|
@ -377,6 +392,8 @@
|
|||
</update>
|
||||
|
||||
<delete id="deleteByTestCaseID" parameterType="java.lang.String">
|
||||
delete from test_plan_api_case where api_case_id = #{id,jdbcType=VARCHAR}
|
||||
delete
|
||||
from test_plan_api_case
|
||||
where api_case_id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
</mapper>
|
|
@ -46,7 +46,7 @@ public class TestPlanController {
|
|||
|
||||
/*jenkins测试计划*/
|
||||
@GetMapping("/list/all/{projectId}/{workspaceId}")
|
||||
public List<TestPlanDTO> listByProjectId(@PathVariable String projectId, @PathVariable String workspaceId) {
|
||||
public List<TestPlanDTOWithMetric> listByProjectId(@PathVariable String projectId, @PathVariable String workspaceId) {
|
||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||
request.setWorkspaceId(workspaceId);
|
||||
request.setProjectId(projectId);
|
||||
|
|
|
@ -379,8 +379,9 @@ public class TestPlanService {
|
|||
return testPlans;
|
||||
}
|
||||
|
||||
public List<TestPlanDTO> listTestPlanByProject(QueryTestPlanRequest request) {
|
||||
return extTestPlanMapper.planList(request);
|
||||
public List<TestPlanDTOWithMetric> listTestPlanByProject(QueryTestPlanRequest request) {
|
||||
List<TestPlanDTOWithMetric> testPlans=extTestPlanMapper.list(request);
|
||||
return testPlans;
|
||||
}
|
||||
|
||||
public void testPlanRelevance(PlanCaseRelevanceRequest request) {
|
||||
|
|
Loading…
Reference in New Issue