fix(接口测试): 修复执行没有csv文件的场景没有提示的缺陷 (#16831)
Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
fd270db2ba
commit
a5ac19d71a
|
@ -39,7 +39,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
||||||
if (StringUtils.isNotBlank(request.getSwaggerUrl())) {
|
if (StringUtils.isNotBlank(request.getSwaggerUrl())) {
|
||||||
try {
|
try {
|
||||||
// 使用 url 导入 swagger
|
// 使用 url 导入 swagger
|
||||||
swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, true);
|
swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LoggerUtil.error(e);
|
LoggerUtil.error(e);
|
||||||
MSException.throwException(e.getMessage());
|
MSException.throwException(e.getMessage());
|
||||||
|
|
|
@ -26,6 +26,7 @@ import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.FileUtils;
|
import io.metersphere.commons.utils.FileUtils;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.constants.RunModeConstants;
|
import io.metersphere.constants.RunModeConstants;
|
||||||
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
||||||
import io.metersphere.plugin.core.MsParameter;
|
import io.metersphere.plugin.core.MsParameter;
|
||||||
import io.metersphere.plugin.core.MsTestElement;
|
import io.metersphere.plugin.core.MsTestElement;
|
||||||
|
@ -113,9 +114,11 @@ public class ElementUtil {
|
||||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||||
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
||||||
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding());
|
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding());
|
||||||
if (CollectionUtils.isNotEmpty(item.getFiles())) {
|
if (CollectionUtils.isEmpty(item.getFiles())) {
|
||||||
|
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||||
|
} else {
|
||||||
if (!config.isOperating() && !new File(BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()).exists()) {
|
if (!config.isOperating() && !new File(BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()).exists()) {
|
||||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ CSV文件不存在 ]");
|
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||||
}
|
}
|
||||||
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
|
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,3 +409,4 @@ ui_element_already_exists_data=An element with the same name already exists
|
||||||
serial=Serial
|
serial=Serial
|
||||||
parallel=Parallel
|
parallel=Parallel
|
||||||
plan_warning=The test plan does not have an associated executable use case
|
plan_warning=The test plan does not have an associated executable use case
|
||||||
|
csv_no_exist=CSV file does not exist
|
||||||
|
|
|
@ -408,3 +408,4 @@ ui_element_already_exists_data=已经存在同名元素
|
||||||
serial=串行
|
serial=串行
|
||||||
parallel=并行
|
parallel=并行
|
||||||
plan_warning=测试计划没有关联可执行的用例
|
plan_warning=测试计划没有关联可执行的用例
|
||||||
|
csv_no_exist=CSV文件不存在
|
||||||
|
|
|
@ -407,3 +407,4 @@ ui_element_already_exists_data=已經存在同名元素
|
||||||
serial=串行
|
serial=串行
|
||||||
parallel=並行
|
parallel=並行
|
||||||
plan_warning=測試計劃沒有關聯可執行的用例
|
plan_warning=測試計劃沒有關聯可執行的用例
|
||||||
|
csv_no_exist=CSV檔案不存在
|
||||||
|
|
Loading…
Reference in New Issue