fix(接口测试): 解决场景覆盖导入报错以及创建case报错以及没有状态问题
--user=郭雨琦 --bug=1014815 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014815 --bug=1014816 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014816 --bug=1014820 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014820 --bug=1014814 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014814
This commit is contained in:
parent
09efdf1119
commit
b3d622b23d
|
@ -1211,7 +1211,7 @@ public class ApiAutomationService {
|
||||||
if (CollectionUtils.isEmpty(sameRequest)) {
|
if (CollectionUtils.isEmpty(sameRequest)) {
|
||||||
scenarioWithBLOBs.setId(UUID.randomUUID().toString());
|
scenarioWithBLOBs.setId(UUID.randomUUID().toString());
|
||||||
scenarioWithBLOBs.setCreateTime(System.currentTimeMillis());
|
scenarioWithBLOBs.setCreateTime(System.currentTimeMillis());
|
||||||
if (!scenarioWithBLOBs.getVersionId().equals("update")) {
|
if (scenarioWithBLOBs.getVersionId() != null && !scenarioWithBLOBs.getVersionId().equals("update")) {
|
||||||
scenarioWithBLOBs.setOrder(getImportNextOrder(apiTestImportRequest.getProjectId()));
|
scenarioWithBLOBs.setOrder(getImportNextOrder(apiTestImportRequest.getProjectId()));
|
||||||
// 导入时设置版本
|
// 导入时设置版本
|
||||||
scenarioWithBLOBs.setRefId(scenarioWithBLOBs.getId());
|
scenarioWithBLOBs.setRefId(scenarioWithBLOBs.getId());
|
||||||
|
@ -1248,7 +1248,7 @@ public class ApiAutomationService {
|
||||||
scenarioWithBLOBs.setCreateTime(System.currentTimeMillis());
|
scenarioWithBLOBs.setCreateTime(System.currentTimeMillis());
|
||||||
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getUpdateVersionId());
|
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getUpdateVersionId());
|
||||||
scenarioWithBLOBs.setLatest(apiTestImportRequest.getVersionId().equals(apiTestImportRequest.getDefaultVersion()));
|
scenarioWithBLOBs.setLatest(apiTestImportRequest.getVersionId().equals(apiTestImportRequest.getDefaultVersion()));
|
||||||
if (!scenarioWithBLOBs.getVersionId().equals("update")) {
|
if (scenarioWithBLOBs.getVersionId() != null && !scenarioWithBLOBs.getVersionId().equals("update")) {
|
||||||
scenarioWithBLOBs.setRefId(sameRequest.get(0).getRefId());
|
scenarioWithBLOBs.setRefId(sameRequest.get(0).getRefId());
|
||||||
scenarioWithBLOBs.setNum(sameRequest.get(0).getNum()); // 使用第一个num当作本次的num
|
scenarioWithBLOBs.setNum(sameRequest.get(0).getNum()); // 使用第一个num当作本次的num
|
||||||
scenarioWithBLOBs.setOrder(sameRequest.get(0).getOrder());
|
scenarioWithBLOBs.setOrder(sameRequest.get(0).getOrder());
|
||||||
|
|
|
@ -853,11 +853,20 @@ public class ApiDefinitionService {
|
||||||
}
|
}
|
||||||
apiTestCaseWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
apiTestCaseWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||||
if (StringUtils.isBlank(apiTestCaseWithBLOBs.getStatus())) {
|
if (StringUtils.isBlank(apiTestCaseWithBLOBs.getStatus())) {
|
||||||
apiTestCaseWithBLOBs.setStatus(APITestStatus.Underway.name());
|
apiTestCaseWithBLOBs.setStatus(APITestStatus.Prepare.name());
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(apiTestCaseWithBLOBs.getCaseStatus())) {
|
||||||
|
apiTestCaseWithBLOBs.setCaseStatus(APITestStatus.Prepare.name());
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(apiTestCaseWithBLOBs.getCreateUserId())) {
|
||||||
|
apiTestCaseWithBLOBs.setCreateUserId(apiDefinition.getUserId());
|
||||||
}
|
}
|
||||||
if (apiTestCaseWithBLOBs.getOrder() == null) {
|
if (apiTestCaseWithBLOBs.getOrder() == null) {
|
||||||
apiTestCaseWithBLOBs.setOrder(getImportNextCaseOrder(apiDefinition.getProjectId()));
|
apiTestCaseWithBLOBs.setOrder(getImportNextCaseOrder(apiDefinition.getProjectId()));
|
||||||
}
|
}
|
||||||
|
if (apiTestCaseWithBLOBs.getNum() == null) {
|
||||||
|
apiTestCaseWithBLOBs.setNum(testCaseService.getNextNum(apiDefinition.getId()));
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(apiTestCaseWithBLOBs.getId())) {
|
if (StringUtils.isNotBlank(apiTestCaseWithBLOBs.getId())) {
|
||||||
apiTestCaseMapper.updateByPrimaryKeyWithBLOBs(apiTestCaseWithBLOBs);
|
apiTestCaseMapper.updateByPrimaryKeyWithBLOBs(apiTestCaseWithBLOBs);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package io.metersphere.commons.constants;
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
public enum APITestStatus {
|
public enum APITestStatus {
|
||||||
Saved, Starting, Running, Reporting, Completed, Debug, Error, Success,Underway,Waiting,Rerunning
|
Saved, Starting, Running, Reporting, Completed, Debug, Error, Success, Underway, Waiting, Rerunning, Prepare
|
||||||
}
|
}
|
||||||
|
|
|
@ -1904,7 +1904,7 @@ public class TestCaseService {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int getNextNum(String projectId) {
|
public int getNextNum(String projectId) {
|
||||||
TestCase testCase = extTestCaseMapper.getMaxNumByProjectId(projectId);
|
TestCase testCase = extTestCaseMapper.getMaxNumByProjectId(projectId);
|
||||||
if (testCase == null || testCase.getNum() == null) {
|
if (testCase == null || testCase.getNum() == null) {
|
||||||
return 100001;
|
return 100001;
|
||||||
|
|
Loading…
Reference in New Issue