Merge branch 'v1.8' of github.com:metersphere/metersphere into v1.8
This commit is contained in:
commit
3f4dda8ccb
|
@ -3,10 +3,7 @@ package io.metersphere.api.service;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
||||
import io.metersphere.api.jmeter.TestResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResultExample;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.TestPlanApiCase;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
|
@ -43,7 +40,7 @@ public class ApiDefinitionExecResultService {
|
|||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
@Resource
|
||||
private TestCaseReviewApiCaseService testCaseReviewApiCaseService;
|
||||
private TestCaseReviewApiCaseService testCaseReviewApiCaseService;
|
||||
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
@ -73,6 +70,13 @@ public class ApiDefinitionExecResultService {
|
|||
testCaseReviewApiCaseService.setExecResult(item.getName(), status);
|
||||
|
||||
}
|
||||
|
||||
// 清空上次执行结果的内容,只保留当前最新一条内容
|
||||
ApiDefinitionExecResult prevResult = extApiDefinitionExecResultMapper.selectMaxResultByResourceIdAndType(item.getName(), type);
|
||||
if (prevResult != null) {
|
||||
prevResult.setContent(null);
|
||||
definitionExecResultMapper.updateByPrimaryKeyWithBLOBs(prevResult);
|
||||
}
|
||||
// 更新用例最后执行结果
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = new ApiTestCaseWithBLOBs();
|
||||
apiTestCaseWithBLOBs.setId(saveResult.getResourceId());
|
||||
|
@ -94,7 +98,7 @@ public class ApiDefinitionExecResultService {
|
|||
*/
|
||||
public void saveApiResultByScheduleTask(TestResult result, String type) {
|
||||
String saveResultType = type;
|
||||
if(StringUtils.equalsAny(ApiRunMode.SCHEDULE_API_PLAN.name(),saveResultType)){
|
||||
if (StringUtils.equalsAny(ApiRunMode.SCHEDULE_API_PLAN.name(), saveResultType)) {
|
||||
saveResultType = ApiRunMode.API_PLAN.name();
|
||||
}
|
||||
|
||||
|
@ -127,6 +131,12 @@ public class ApiDefinitionExecResultService {
|
|||
}
|
||||
|
||||
saveResult.setUserId(userID);
|
||||
// 前一条数据内容清空
|
||||
ApiDefinitionExecResult prevResult = extApiDefinitionExecResultMapper.selectMaxResultByResourceIdAndType(item.getName(), finalSaveResultType);
|
||||
if (prevResult != null) {
|
||||
prevResult.setContent(null);
|
||||
apiDefinitionExecResultMapper.updateByPrimaryKeyWithBLOBs(prevResult);
|
||||
}
|
||||
apiDefinitionExecResultMapper.insert(saveResult);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -517,7 +517,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
public void addResult(TestResult res) {
|
||||
if (!res.getScenarios().isEmpty() && !res.getScenarios().get(0).getRequestResults().isEmpty()) {
|
||||
if (res != null && CollectionUtils.isNotEmpty(res.getScenarios()) && res.getScenarios().get(0) != null && CollectionUtils.isNotEmpty(res.getScenarios().get(0).getRequestResults())) {
|
||||
RequestResult result = res.getScenarios().get(0).getRequestResults().get(0);
|
||||
if (result.getName().indexOf("<->") != -1) {
|
||||
result.setName(result.getName().substring(0, result.getName().indexOf("<->")));
|
||||
|
|
|
@ -253,6 +253,13 @@ public class ApiScenarioReportService {
|
|||
String status = "Success";
|
||||
report.setStatus(status);
|
||||
scenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
// 把上一条调试的数据内容清空
|
||||
ApiScenarioReport prevResult = extApiScenarioReportMapper.selectPreviousReportByScenarioId(report.getScenarioId(), reportId);
|
||||
if (prevResult != null) {
|
||||
ApiScenarioReportDetailExample example = new ApiScenarioReportDetailExample();
|
||||
example.createCriteria().andReportIdEqualTo(prevResult.getId());
|
||||
apiScenarioReportDetailMapper.deleteByExample(example);
|
||||
}
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
|
|||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import io.metersphere.base.domain.ApiScenarioReport;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
@ -23,4 +24,7 @@ public interface ExtApiScenarioReportMapper {
|
|||
List<ApiDataCountResult> countByProjectIdGroupByExecuteResult(String projectId);
|
||||
|
||||
List<ApiScenarioReport> selectLastReportByIds(@Param("scenarioIdList") List<String> ids);
|
||||
|
||||
ApiScenarioReport selectPreviousReportByScenarioId(@Param("scenarioId") String scenarioId, @Param("nowId") String nowId);
|
||||
|
||||
}
|
|
@ -216,4 +216,9 @@
|
|||
) orderData ON orderData.id = report.id;
|
||||
</select>
|
||||
|
||||
<select id="selectPreviousReportByScenarioId" resultType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
select * from api_scenario_report
|
||||
WHERE execute_type in ("Completed","Debug") and scenario_id=#{scenarioId} and id != #{nowId} ORDER BY create_time desc LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -50,39 +50,41 @@
|
|||
</div>
|
||||
</ms-aside-container>
|
||||
|
||||
<ms-main-container v-if="!loading">
|
||||
<!-- 第一层当前节点内容-->
|
||||
<ms-component-config
|
||||
:isMax="false"
|
||||
:showBtn="false"
|
||||
:type="selectedTreeNode.type"
|
||||
:scenario="selectedTreeNode"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:node="selectedNode"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
<!-- 请求下还有的子步骤-->
|
||||
<div v-if="selectedTreeNode && selectedTreeNode.hashTree && showNode(selectedTreeNode)">
|
||||
<div v-for="item in selectedTreeNode.hashTree" :key="item.id" class="ms-col-one">
|
||||
<ms-component-config
|
||||
:showBtn="false"
|
||||
:isMax="false"
|
||||
:type="item.type"
|
||||
:scenario="item"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"
|
||||
@refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
<ms-main-container v-loading="loading">
|
||||
<div v-if="!loading">
|
||||
<!-- 第一层当前节点内容-->
|
||||
<ms-component-config
|
||||
:isMax="false"
|
||||
:showBtn="false"
|
||||
:type="selectedTreeNode.type"
|
||||
:scenario="selectedTreeNode"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:node="selectedNode"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
<!-- 请求下还有的子步骤-->
|
||||
<div v-if="selectedTreeNode && selectedTreeNode.hashTree && showNode(selectedTreeNode)">
|
||||
<div v-for="item in selectedTreeNode.hashTree" :key="item.id" class="ms-col-one">
|
||||
<ms-component-config
|
||||
:showBtn="false"
|
||||
:isMax="false"
|
||||
:type="item.type"
|
||||
:scenario="item"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"
|
||||
@refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ms-main-container>
|
||||
|
@ -477,6 +479,7 @@
|
|||
}
|
||||
this.selectedTreeNode = data;
|
||||
this.selectedNode = node;
|
||||
this.reload();
|
||||
},
|
||||
suggestClick(node) {
|
||||
this.response = {};
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2115bd28a90854d2b6276a90878934715498c584
|
||||
Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd
|
Loading…
Reference in New Issue