fix(测试跟踪): 导入postman跟随重定向设置

--bug=1014825 --user=陈建星 【接口测试】导入postman文件,设置了跟随重定向,导入后没勾选重定向 {#_orginal_url#}
This commit is contained in:
chenjianxing 2022-07-14 11:57:47 +08:00 committed by jianxing
parent 6ccca9dc28
commit fddf5d3b4e
3 changed files with 23 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package io.metersphere.api.dto.parse.postman; package io.metersphere.api.dto.parse.postman;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.List; import java.util.List;
@ -11,4 +13,11 @@ public class PostmanItem {
private PostmanRequest request; private PostmanRequest request;
private List<PostmanResponse> response; private List<PostmanResponse> response;
private List<PostmanItem> item; private List<PostmanItem> item;
private ProtocolProfileBehavior protocolProfileBehavior;
@Getter
@Setter
public class ProtocolProfileBehavior {
private Boolean followRedirects = true;
}
} }

View File

@ -43,6 +43,13 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
request.setArguments(parseKeyValue(url == null ? new ArrayList<>() : url.getQuery())); request.setArguments(parseKeyValue(url == null ? new ArrayList<>() : url.getQuery()));
request.setHeaders(parseKeyValue(requestDesc.getHeader())); request.setHeaders(parseKeyValue(requestDesc.getHeader()));
addBodyHeader(request); addBodyHeader(request);
PostmanItem.ProtocolProfileBehavior protocolProfileBehavior = requestItem.getProtocolProfileBehavior();
if (protocolProfileBehavior != null &&
!protocolProfileBehavior.getFollowRedirects()) {
request.setFollowRedirects(false);
} else {
request.setFollowRedirects(true);
}
return request; return request;
} }

View File

@ -151,7 +151,13 @@ public class TestPlanTestCaseService {
//记录功能用例执行信息 //记录功能用例执行信息
functionCaseExecutionInfoService.insertExecutionInfo(testPlanTestCase.getId(), testPlanTestCase.getStatus()); functionCaseExecutionInfoService.insertExecutionInfo(testPlanTestCase.getId(), testPlanTestCase.getStatus());
} }
testPlanTestCase.setExecutor(SessionUtils.getUser().getId()); if (StringUtils.isNotBlank(testPlanTestCase.getStatus())) {
TestPlanTestCaseWithBLOBs originData = testPlanTestCaseMapper.selectByPrimaryKey(testPlanTestCase.getId());
if (!StringUtils.equals(originData.getStatus(), testPlanTestCase.getStatus())) {
// 更新了状态才更新执行人
testPlanTestCase.setExecutor(SessionUtils.getUser().getId());
}
}
testPlanTestCase.setUpdateTime(System.currentTimeMillis()); testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCase.setRemark(null); testPlanTestCase.setRemark(null);
testPlanTestCaseMapper.updateByPrimaryKeySelective(testPlanTestCase); testPlanTestCaseMapper.updateByPrimaryKeySelective(testPlanTestCase);