fix: jenkins接口修改

This commit is contained in:
wenyann 2020-12-31 15:11:08 +08:00
parent a683bb27ff
commit 3155af90f5
8 changed files with 50 additions and 8 deletions

View File

@ -85,15 +85,15 @@ public class ApiAutomationController {
}
@PostMapping(value = "/run")
public void run(@RequestBody RunScenarioRequest request) {
public String run(@RequestBody RunScenarioRequest request) {
request.setExecuteType(ExecuteType.Completed.name());
apiAutomationService.run(request);
return apiAutomationService.run(request);
}
@PostMapping(value = "/run/batch")
public void runBatch(@RequestBody RunScenarioRequest request) {
public String runBatch(@RequestBody RunScenarioRequest request) {
request.setExecuteType(ExecuteType.Saved.name());
apiAutomationService.run(request);
return apiAutomationService.run(request);
}

View File

@ -333,6 +333,13 @@
and project_id= #{request.projectId}
</if>
</where>
UNION ALL
select id,name,status,project_id,"scenario" as type from api_scenario
<where>
<if test="request.projectId!=null">
and project_id= #{request.projectId}
</if>
</where>
</select>
<select id="listByTestCaseIds" resultType="io.metersphere.track.dto.TestCaseDTO">
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on

View File

@ -15,6 +15,8 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> list(@Param("request") QueryTestPlanCaseRequest request);
List<TestPlanCaseDTO> listByPlanId(@Param("request") QueryTestPlanCaseRequest request);
List<TestPlanCaseDTO> listByNode(@Param("request") QueryTestPlanCaseRequest request);
List<TestPlanCaseDTO> listByNodes(@Param("request") QueryTestPlanCaseRequest request);

View File

@ -336,6 +336,34 @@
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
<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
<where>
<if test="request.planId != null">
and test_plan_api_scenario.test_plan_id = #{request.planId}
</if>
</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
<where>
<if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
</where>
</select>
<update id="updateTestCaseStates" parameterType="java.lang.String">
update test_plan_test_case

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants;
public enum ApiRunMode {
RUN, DEBUG,DELIMIT,SCENARIO, API_PLAN, SCENARIO_PLAN
RUN, DEBUG,DELIMIT,SCENARIO, API_PLAN, SCENARIO_PLAN,API
}

View File

@ -57,7 +57,7 @@ public class TestCaseController {
return testCaseService.listTestCase(request);
}
/*jenkins项目下所有接口和性能测试用例*/
@GetMapping("/list/method/{projectId}")
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
QueryTestCaseRequest request = new QueryTestCaseRequest();

View File

@ -30,13 +30,13 @@ public class TestPlanTestCaseController {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
}
/*jenkins测试计划下全部用例*/
@GetMapping("/list/{planId}")
public List<TestPlanCaseDTO> getTestPlanCaseByPlanId(@PathVariable String planId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);
request.setMethod("auto");
return testPlanTestCaseService.list(request);
return testPlanTestCaseService.listByPlanId(request);
}
@GetMapping("/list/node/{planId}/{nodePaths}")

View File

@ -55,6 +55,11 @@ public class TestPlanTestCaseService {
});
return list;
}
public List<TestPlanCaseDTO> listByPlanId(QueryTestPlanCaseRequest request) {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByPlanId(request);
return list;
}
public List<TestPlanCaseDTO> listByNode(QueryTestPlanCaseRequest request) {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByNode(request);