fix(功能测试、系统设置): #1006043 #1005905 #1005715 修改并发数保存后提示500 error;【测试用例】导出xmind格式报错;【测试跟踪】-导出测试用例-导出文档用例状态错误

【【系统设置】-【基本设置】-修改并发数保存后提示500
error】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006043;【【测试用例】导出xmind格式报错】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001005905;【【测试跟踪】-导出测试用例-导出文档用例状态错误】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001005715
This commit is contained in:
song-tianyang 2021-08-25 15:07:47 +08:00 committed by 刘瑞斌
parent c608062cd2
commit caa9c2197a
7 changed files with 65 additions and 7 deletions

View File

@ -175,7 +175,7 @@ public class ApiTestEnvironmentService {
boolean needUpdate = false;
ProjectService projectService = CommonBeanFactory.getBean(ProjectService.class);
Project project = projectService.getProjectById(projectId);
if (returnModel.getConfig() != null) {
if (returnModel.getConfig() != null && project != null) {
try {
JSONObject configObj = JSONObject.parseObject(returnModel.getConfig());
if (configObj.containsKey("httpConfig")) {
@ -256,6 +256,9 @@ public class ApiTestEnvironmentService {
}
private ApiTestEnvironmentWithBLOBs genHttpApiTestEnvironmentByUrl(Project project,String projectNumber, String protocal, String name, String baseUrl) {
if(project == null){
return null;
}
String socket = "";
String url = baseUrl;
if (url.startsWith("http://")) {

View File

@ -980,8 +980,8 @@ public class TestCaseService {
list.add(model.getStepModel());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Priority","用例等級","用例等级")){
list.add(model.getPriority());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){
list.add(model.getStatus());
// }else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){
// list.add(model.getStatus());
} else if (StringUtils.equalsAnyIgnoreCase(head, "Maintainer(ID)", "责任人(ID)", "維護人(ID)")) {
String value = customDataMaps.get("责任人");
value = value == null ? "" : value;
@ -1023,6 +1023,45 @@ public class TestCaseService {
List<TestCaseExcelData> list = new ArrayList<>();
StringBuilder step = new StringBuilder("");
StringBuilder result = new StringBuilder("");
Map<String,Map<String,String>> customSelectValueMap = new HashMap<>();
TestCaseTemplateService testCaseTemplateService = CommonBeanFactory.getBean(TestCaseTemplateService.class);
TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId());
List<CustomFieldDao> customFieldList = null;
if (testCaseTemplate == null) {
customFieldList = new ArrayList<>();
} else {
customFieldList = testCaseTemplate.getCustomFields();
}
for (CustomFieldDao dto :customFieldList) {
Map<String,String> map = new HashMap<>();
if(StringUtils.equals("select",dto.getType())){
try {
JSONArray optionsArr = JSONArray.parseArray(dto.getOptions());
for (int i = 0; i < optionsArr.size();i++) {
JSONObject obj = optionsArr.getJSONObject(i);
if(obj.containsKey("text") && obj.containsKey("value")){
String value = obj.getString("value");
String text = obj.getString("text");
if(StringUtils.equals(text,"test_track.case.status_finished")){
text = Translator.get("test_case_status_finished");
}else if(StringUtils.equals(text,"test_track.case.status_prepare")){
text = Translator.get("test_case_status_prepare");
}else if(StringUtils.equals(text,"test_track.case.status_running")){
text = Translator.get("test_case_status_running");
}
if(StringUtils.isNotEmpty(value)){
map.put(value,text);
}
}
}
}catch (Exception e){}
}
customSelectValueMap.put(dto.getName(),map);
}
testCaseList.forEach(t -> {
TestCaseExcelData data = new TestCaseExcelData();
data.setNum(t.getNum());
@ -1039,7 +1078,6 @@ public class TestCaseService {
} else {
data.setStepModel(t.getStepModel());
}
// data.setMethod(t.getMethod());
data.setPrerequisite(t.getPrerequisite());
data.setTags(t.getTags());
if (StringUtils.equals(t.getMethod(), "manual") || StringUtils.isBlank(t.getMethod())) {
@ -1106,7 +1144,15 @@ public class TestCaseService {
for(int index = 0; index < customFieldsArr.size(); index ++){
JSONObject obj = customFieldsArr.getJSONObject(index);
if(obj.containsKey("name") && obj.containsKey("value")){
map.put(obj.getString("name"),obj.getString("value"));
//进行key value对换
String name = obj.getString("name");
String value = obj.getString("value");
if(customSelectValueMap.containsKey(name)){
if(customSelectValueMap.get(name).containsKey(value)){
value = customSelectValueMap.get(name).get(value);
}
}
map.put(name,value);
}
}
data.setCustomDatas(map);

View File

@ -27,6 +27,7 @@ public class TestCaseXmindData {
public TestCaseXmindData(String moduleId, String moduleName) {
this.moduleId = moduleId;
this.moduleName = moduleName;
this.testCaseList = new ArrayList<>();
}
public void setItem(LinkedList<TestCaseNode> modulePathDataList, List<TestCaseDTO> dataList) {

View File

@ -265,6 +265,9 @@ personal_information_personal_settings=Personal information personal settings
personal_information_apikeys=Personal information API Keys
auth_title=Auth
group_permission=Group
test_case_status_prepare=Rrepare
test_case_status_running=Running
test_case_status_finished=Finished
# track home
api_case=API
performance_case=PERFORMANCE

View File

@ -264,7 +264,9 @@ personal_information_personal_settings=个人信息-个人设置
personal_information_apikeys=个人信息-API Keys
auth_title=系统认证
group_permission=用户组与权限
test_case_status_prepare=未开始
test_case_status_running=进行中
test_case_status_finished=已完成
# track home
api_case=接口用例
performance_case=性能用例

View File

@ -269,5 +269,8 @@ group_permission=用戶組與權限
api_case=接口用例
performance_case=性能用例
scenario_case=場景用例
test_case_status_prepare=未開始
test_case_status_running=進行中
test_case_status_finished=已完成
id_not_rightful=ID 不合法

View File

@ -34,7 +34,7 @@
@setCondition="setCondition"
@decrease="decrease"
:custom-num="custom_num"
ref="testCaseList">
ref="testCaseTrashList">
</test-case-list>
</el-tab-pane>
<el-tab-pane name="default" :label="$t('api_test.definition.case_title')">