diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index 8238f27752..55fdb3b511 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -32,6 +32,7 @@ import io.metersphere.base.domain.ApiDefinitionWithBLOBs; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.commons.constants.LoopConstants; import io.metersphere.commons.constants.MsTestElementConstants; +import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.LogUtil; @@ -48,6 +49,7 @@ import org.apache.jorphan.collections.HashTree; import org.apache.jorphan.collections.ListedHashTree; import java.io.ByteArrayOutputStream; +import java.io.File; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -211,6 +213,9 @@ public abstract class MsTestElement { csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName()); csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding()); if (CollectionUtils.isNotEmpty(item.getFiles())) { + if (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文件不存在 ]"); + } csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()); } csvDataSet.setIgnoreFirstLine(false); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java index 35d4503d11..b9d28f7cc4 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java @@ -67,7 +67,8 @@ public class MsAssertions extends MsTestElement { private ResponseAssertion responseAssertion(MsAssertionRegex assertionRegex) { ResponseAssertion assertion = new ResponseAssertion(); assertion.setEnabled(this.isEnable()); - assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : assertionRegex.getDescription()); + assertion.setName(assertionRegex.getDescription()); + assertion.setName(StringUtils.isNotEmpty(assertionRegex.getDescription()) ? assertionRegex.getDescription() : this.getName()); assertion.setProperty(TestElement.TEST_CLASS, ResponseAssertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("AssertionGui")); assertion.setAssumeSuccess(assertionRegex.isAssumeSuccess()); @@ -92,7 +93,8 @@ public class MsAssertions extends MsTestElement { private JSONPathAssertion jsonPathAssertion(MsAssertionJsonPath assertionJsonPath) { JSONPathAssertion assertion = new JSONPathAssertion(); assertion.setEnabled(this.isEnable()); - assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSONPathAssertion"); + assertion.setName(StringUtils.isNotEmpty(assertionJsonPath.getDescription()) ? assertionJsonPath.getDescription() : this.getName()); + /* assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSONPathAssertion");*/ assertion.setProperty(TestElement.TEST_CLASS, JSONPathAssertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPathAssertionGui")); assertion.setJsonPath(assertionJsonPath.getExpression()); @@ -112,7 +114,8 @@ public class MsAssertions extends MsTestElement { private XPath2Assertion xPath2Assertion(MsAssertionXPath2 assertionXPath2) { XPath2Assertion assertion = new XPath2Assertion(); assertion.setEnabled(this.isEnable()); - assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "XPath2Assertion"); + assertion.setName(StringUtils.isNotEmpty(assertionXPath2.getExpression()) ? assertionXPath2.getExpression() : this.getName()); + /*assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "XPath2Assertion");*/ assertion.setProperty(TestElement.TEST_CLASS, XPath2Assertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2AssertionGui")); assertion.setXPathString(assertionXPath2.getExpression()); @@ -123,7 +126,8 @@ public class MsAssertions extends MsTestElement { private DurationAssertion durationAssertion(MsAssertionDuration assertionDuration) { DurationAssertion assertion = new DurationAssertion(); assertion.setEnabled(this.isEnable()); - assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Response In Time: " + assertionDuration.getValue()); + assertion.setName("Response In Time: " + assertionDuration.getValue()); + /* assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Response In Time: " + assertionDuration.getValue());*/ assertion.setProperty(TestElement.TEST_CLASS, DurationAssertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DurationAssertionGui")); assertion.setAllowedDuration(assertionDuration.getValue()); @@ -133,7 +137,8 @@ public class MsAssertions extends MsTestElement { private JSR223Assertion jsr223Assertion(MsAssertionJSR223 assertionJSR223) { JSR223Assertion assertion = new JSR223Assertion(); assertion.setEnabled(this.isEnable()); - assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSR223Assertion"); + assertion.setName(StringUtils.isNotEmpty(assertionJSR223.getDesc()) ? assertionJSR223.getDesc() : this.getName()); + /*assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSR223Assertion");*/ assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); assertion.setProperty("cacheKey", "true"); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/extract/MsExtract.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/extract/MsExtract.java index 79951094a1..6a41b3d039 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/extract/MsExtract.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/extract/MsExtract.java @@ -70,7 +70,8 @@ public class MsExtract extends MsTestElement { RegexExtractor extractor = new RegexExtractor(); extractor.setEnabled(this.isEnable()); - extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " RegexExtractor"); + extractor.setName(StringUtils.isNotEmpty(extractRegex.getVariable()) ? extractRegex.getVariable() : this.getName()); + /*extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " RegexExtractor");*/ extractor.setProperty(TestElement.TEST_CLASS, RegexExtractor.class.getName()); extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("RegexExtractorGui")); extractor.setRefName(extractRegex.getVariable()); @@ -88,7 +89,8 @@ public class MsExtract extends MsTestElement { private XPath2Extractor xPath2Extractor(MsExtractXPath extractXPath, StringJoiner extract) { XPath2Extractor extractor = new XPath2Extractor(); extractor.setEnabled(this.isEnable()); - extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " XPath2Extractor"); + extractor.setName(StringUtils.isNotEmpty(extractXPath.getVariable()) ? extractXPath.getVariable() : this.getName()); + /*extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " XPath2Extractor");*/ extractor.setProperty(TestElement.TEST_CLASS, XPath2Extractor.class.getName()); extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2ExtractorGui")); extractor.setRefName(extractXPath.getVariable()); @@ -103,7 +105,8 @@ public class MsExtract extends MsTestElement { private JSONPostProcessor jsonPostProcessor(MsExtractJSONPath extractJSONPath, StringJoiner extract) { JSONPostProcessor extractor = new JSONPostProcessor(); extractor.setEnabled(this.isEnable()); - extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " JSONExtractor"); + extractor.setName(StringUtils.isNotEmpty(extractJSONPath.getVariable()) ? extractJSONPath.getVariable() : this.getName()); + /*extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " JSONExtractor");*/ extractor.setProperty(TestElement.TEST_CLASS, JSONPostProcessor.class.getName()); extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPostProcessorGui")); extractor.setRefNames(extractJSONPath.getVariable()); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java index 38237e19f9..710ab4b672 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java @@ -3,11 +3,14 @@ package io.metersphere.api.dto.definition.request.unknown; import com.alibaba.fastjson.annotation.JSONType; import io.metersphere.api.dto.definition.request.MsTestElement; import io.metersphere.api.dto.definition.request.ParameterConfig; +import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.LogUtil; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.jmeter.config.CSVDataSet; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.TestPlan; @@ -15,6 +18,7 @@ import org.apache.jmeter.threads.ThreadGroup; import org.apache.jorphan.collections.HashTree; import java.io.ByteArrayInputStream; +import java.io.File; import java.io.InputStream; import java.util.List; @@ -53,6 +57,13 @@ public class MsJmeterElement extends MsTestElement { if (!config.isOperating() && scriptWrapper instanceof ThreadGroup && !((ThreadGroup) scriptWrapper).isEnabled()) { LogUtil.info(((ThreadGroup) scriptWrapper).getName() + "是被禁用线程组不加入执行"); } else { + // CSV数据检查文件路径是否还存在 + if (scriptWrapper instanceof CSVDataSet) { + String path = ((CSVDataSet) scriptWrapper).getPropertyAsString("filename"); + if (!new File(path).exists()) { + MSException.throwException(StringUtils.isEmpty(((CSVDataSet) scriptWrapper).getName()) ? "CSVDataSet" : ((CSVDataSet) scriptWrapper).getName() + ":[ CSV文件不存在 ]"); + } + } if (CollectionUtils.isNotEmpty(hashTree)) { for (MsTestElement el : hashTree) { el.toHashTree(elementTree, el.getHashTree(), config); @@ -62,6 +73,7 @@ public class MsJmeterElement extends MsTestElement { } } catch (Exception ex) { ex.printStackTrace(); + MSException.throwException(ex.getMessage()); } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 8096f1e974..4b4abebdb6 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -535,8 +535,12 @@ public class ApiAutomationService { } // 生成报告和HashTree - HashTree hashTree = generateHashTree(item, reportId, planEnvMap); - + HashTree hashTree = null; + try { + hashTree = generateHashTree(item, reportId, planEnvMap); + } catch (Exception ex) { + MSException.throwException(ex.getMessage()); + } //存储报告 batchMapper.insert(report); @@ -602,7 +606,12 @@ public class ApiAutomationService { } ParameterConfig config = new ParameterConfig(); config.setConfig(envConfig); - HashTree hashTree = request.getTestElement().generateHashTree(config); + HashTree hashTree = null; + try { + hashTree = request.getTestElement().generateHashTree(config); + } catch (Exception e) { + MSException.throwException(e.getMessage()); + } // 调用执行方法 APIScenarioReportResult reportResult = createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(), SessionUtils.getUserId()); diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java index 16f0754d4f..47e4c5c535 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java @@ -1,18 +1,19 @@ package io.metersphere.base.domain; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; @Data public class TestCaseTest implements Serializable { - private String id; - private String testCaseId; private String testId; private String testType; + private Long createTime; + + private Long updateTime; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java index dade071131..6453335cc2 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java @@ -104,76 +104,6 @@ public class TestCaseTestExample { criteria.add(new Criterion(condition, value1, value2)); } - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(String value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(String value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(String value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(String value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(String value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(String value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLike(String value) { - addCriterion("id like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotLike(String value) { - addCriterion("id not like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(String value1, String value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(String value1, String value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - public Criteria andTestCaseIdIsNull() { addCriterion("test_case_id is null"); return (Criteria) this; @@ -383,6 +313,126 @@ public class TestCaseTestExample { addCriterion("test_type not between", value1, value2, "testType"); return (Criteria) this; } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java index 444584fe4e..f8fcb8eee6 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java @@ -2,30 +2,21 @@ package io.metersphere.base.mapper; import io.metersphere.base.domain.TestCaseTest; import io.metersphere.base.domain.TestCaseTestExample; -import org.apache.ibatis.annotations.Param; - import java.util.List; +import org.apache.ibatis.annotations.Param; public interface TestCaseTestMapper { long countByExample(TestCaseTestExample example); int deleteByExample(TestCaseTestExample example); - int deleteByPrimaryKey(String id); - int insert(TestCaseTest record); int insertSelective(TestCaseTest record); List selectByExample(TestCaseTestExample example); - TestCaseTest selectByPrimaryKey(String id); - int updateByExampleSelective(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); int updateByExample(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); - - int updateByPrimaryKeySelective(TestCaseTest record); - - int updateByPrimaryKey(TestCaseTest record); } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml index af19225f39..45bf667ec5 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml @@ -1,201 +1,175 @@ - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + - - - - id, test_case_id, test_id, test_type - - - - - delete - from test_case_test - where id = #{id,jdbcType=VARCHAR} - - - delete from test_case_test - - - - - - insert into test_case_test (id, test_case_id, test_id, - test_type) - values (#{id,jdbcType=VARCHAR}, #{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, - #{testType,jdbcType=VARCHAR}) - - - insert into test_case_test - - - id, - - - test_case_id, - - - test_id, - - - test_type, - - - - - #{id,jdbcType=VARCHAR}, - - - #{testCaseId,jdbcType=VARCHAR}, - - - #{testId,jdbcType=VARCHAR}, - - - #{testType,jdbcType=VARCHAR}, - - - - - - update test_case_test - - - id = #{record.id,jdbcType=VARCHAR}, - - - test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, - - - test_id = #{record.testId,jdbcType=VARCHAR}, - - - test_type = #{record.testType,jdbcType=VARCHAR}, - - - - - - - - update test_case_test - set id = #{record.id,jdbcType=VARCHAR}, + + + + + test_case_id, test_id, test_type, create_time, update_time + + + + delete from test_case_test + + + + + + insert into test_case_test (test_case_id, test_id, test_type, + create_time, update_time) + values (#{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{testType,jdbcType=VARCHAR}, + #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}) + + + insert into test_case_test + + + test_case_id, + + + test_id, + + + test_type, + + + create_time, + + + update_time, + + + + + #{testCaseId,jdbcType=VARCHAR}, + + + #{testId,jdbcType=VARCHAR}, + + + #{testType,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + + + + update test_case_test + + test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, + + test_id = #{record.testId,jdbcType=VARCHAR}, - test_type = #{record.testType,jdbcType=VARCHAR} - - - - - - update test_case_test - - - test_case_id = #{testCaseId,jdbcType=VARCHAR}, - - - test_id = #{testId,jdbcType=VARCHAR}, - - - test_type = #{testType,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=VARCHAR} - - - update test_case_test - set test_case_id = #{testCaseId,jdbcType=VARCHAR}, - test_id = #{testId,jdbcType=VARCHAR}, - test_type = #{testType,jdbcType=VARCHAR} - where id = #{id,jdbcType=VARCHAR} - + + + test_type = #{record.testType,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + + + + + + update test_case_test + set test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, + test_id = #{record.testId,jdbcType=VARCHAR}, + test_type = #{record.testType,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT} + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.java index c95006f3b8..a6c67b6c5b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.java @@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext; import io.metersphere.base.domain.FileMetadata; import io.metersphere.base.domain.LoadTest; import io.metersphere.dto.LoadTestDTO; +import io.metersphere.performance.request.QueryProjectFileRequest; import io.metersphere.performance.request.QueryTestPlanRequest; import org.apache.ibatis.annotations.Param; @@ -18,6 +19,7 @@ public interface ExtLoadTestMapper { LoadTest getNextNum(@Param("projectId") String projectId); - List getProjectFiles(@Param("projectId") String projectId, @Param("loadTypes") List loadType); + List getProjectFiles(@Param("projectId") String projectId, @Param("loadTypes") List loadType, + @Param("request") QueryProjectFileRequest request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml index 6e77469707..8580002eff 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml @@ -145,5 +145,8 @@ #{id} AND project_id = #{projectId,jdbcType=VARCHAR} + + AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%') + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index 17ae2078b3..9a8e381c1f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -65,7 +65,7 @@ public interface ExtTestCaseMapper { long countRelevanceCreatedThisWeek(@Param("projectId") String projectId,@Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); - List countCoverage(@Param("projectId") String projectId); + int countCoverage(@Param("projectId") String projectId); List countFuncMaintainer(@Param("projectId") String projectId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index aeef002a4e..f5a09e4567 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -343,17 +343,19 @@ - + select count(test_case.id) from test_case where test_case.project_id = #{projectId} + and test_case.id in (select distinct test_case_test.test_case_id from test_case_test) + update test_plan_test_case diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index da19e2da3c..21f845385d 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -120,12 +120,13 @@ public class PerformanceTestController { return performanceTestService.exportJmx(fileIds); } - @GetMapping("/project/{loadType}/{projectId}/{goPage}/{pageSize}") + @PostMapping("/project/{loadType}/{projectId}/{goPage}/{pageSize}") public Pager> getProjectFiles(@PathVariable String projectId, @PathVariable String loadType, - @PathVariable int goPage, @PathVariable int pageSize) { + @PathVariable int goPage, @PathVariable int pageSize, + @RequestBody QueryProjectFileRequest request) { checkPermissionService.checkProjectOwner(projectId); Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, performanceTestService.getProjectFiles(projectId, loadType)); + return PageUtils.setPageInfo(page, performanceTestService.getProjectFiles(projectId, loadType, request)); } @PostMapping("/delete") diff --git a/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java b/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java index 5c5e9d88fb..f67454fa1a 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java @@ -19,8 +19,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.List; -import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; public abstract class AbstractEngine implements Engine { protected String JMETER_IMAGE; @@ -106,17 +106,20 @@ public abstract class AbstractEngine implements Engine { String loadConfiguration = t.getLoadConfiguration(); JSONArray jsonArray = JSON.parseArray(loadConfiguration); for (int i = 0; i < jsonArray.size(); i++) { - if (jsonArray.get(i) instanceof Map) { - JSONObject o = jsonArray.getJSONObject(i); - if (StringUtils.equals(o.getString("key"), "TargetLevel")) { - s = o.getInteger("value"); - break; - } - } if (jsonArray.get(i) instanceof List) { JSONArray o = jsonArray.getJSONArray(i); - for (int j = 0; j < o.size(); j++) { - JSONObject b = o.getJSONObject(j); + List enabledConfig = o.stream() + .filter(b -> { + JSONObject c = JSON.parseObject(b.toString()); + if (StringUtils.equals(c.getString("deleted"), "true")) { + return false; + } + return !StringUtils.equals(c.getString("enabled"), "false"); + }) + .map(b -> JSON.parseObject(b.toString())) + .collect(Collectors.toList()); + + for (JSONObject b : enabledConfig) { if (StringUtils.equals(b.getString("key"), "TargetLevel")) { s += b.getInteger("value"); break; diff --git a/backend/src/main/java/io/metersphere/performance/request/QueryProjectFileRequest.java b/backend/src/main/java/io/metersphere/performance/request/QueryProjectFileRequest.java index 90c71dcb8a..a8808c1c8c 100644 --- a/backend/src/main/java/io/metersphere/performance/request/QueryProjectFileRequest.java +++ b/backend/src/main/java/io/metersphere/performance/request/QueryProjectFileRequest.java @@ -4,5 +4,5 @@ import lombok.Data; @Data public class QueryProjectFileRequest { - private String filename; + private String name; } diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 6a73af82b5..8e33726a6f 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -561,19 +561,23 @@ public class PerformanceTestService { } } - public List getProjectFiles(String projectId, String loadType) { + public List getProjectFiles(String projectId, String loadType, QueryProjectFileRequest request) { List loadTypes = new ArrayList<>(); loadTypes.add(StringUtils.upperCase(loadType)); if (StringUtils.equalsIgnoreCase(loadType, "resource")) { - loadTypes.add(FileType.CSV.name()); - loadTypes.add(FileType.JAR.name()); + List fileTypes = Arrays.stream(FileType.values()) + .filter(fileType -> !fileType.equals(FileType.JMX)) + .map(FileType::name) + .collect(Collectors.toList()); + loadTypes.addAll(fileTypes); } if (StringUtils.equalsIgnoreCase(loadType, "all")) { - loadTypes.add(FileType.CSV.name()); - loadTypes.add(FileType.JAR.name()); - loadTypes.add(FileType.JMX.name()); + List fileTypes = Arrays.stream(FileType.values()) + .map(FileType::name) + .collect(Collectors.toList()); + loadTypes.addAll(fileTypes); } - return extLoadTestMapper.getProjectFiles(projectId, loadTypes); + return extLoadTestMapper.getProjectFiles(projectId, loadTypes, request); } public List exportJmx(List fileIds) { diff --git a/backend/src/main/java/io/metersphere/service/FileService.java b/backend/src/main/java/io/metersphere/service/FileService.java index e1d7b3ffd1..cc2aa106c2 100644 --- a/backend/src/main/java/io/metersphere/service/FileService.java +++ b/backend/src/main/java/io/metersphere/service/FileService.java @@ -202,8 +202,8 @@ public class FileService { FileMetadataExample example = new FileMetadataExample(); FileMetadataExample.Criteria criteria = example.createCriteria(); criteria.andProjectIdEqualTo(projectId); - if (!StringUtils.isEmpty(request.getFilename())) { - criteria.andNameEqualTo(request.getFilename()); + if (!StringUtils.isEmpty(request.getName())) { + criteria.andNameEqualTo(request.getName()); } return fileMetadataMapper.selectByExample(example); } diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 77a218d37e..d0b601c31c 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -173,7 +173,7 @@ public class ProjectService { if (files != null) { for (MultipartFile file : files) { QueryProjectFileRequest request = new QueryProjectFileRequest(); - request.setFilename(file.getOriginalFilename()); + request.setName(file.getOriginalFilename()); if (CollectionUtils.isEmpty(fileService.getProjectFiles(projectId, request))) { fileService.saveFile(file, projectId); } else { diff --git a/backend/src/main/java/io/metersphere/track/controller/TrackController.java b/backend/src/main/java/io/metersphere/track/controller/TrackController.java index c010d94bc2..1dc69994d2 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TrackController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TrackController.java @@ -1,11 +1,13 @@ package io.metersphere.track.controller; +import io.metersphere.base.domain.TestCase; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.performance.base.ChartsData; import io.metersphere.track.response.BugStatustics; import io.metersphere.track.response.TrackCountResult; import io.metersphere.track.response.TrackStatisticsDTO; +import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TrackService; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresRoles; @@ -25,6 +27,8 @@ public class TrackController { @Resource private TrackService trackService; + @Resource + private TestCaseService testCaseService; @GetMapping("/count/{projectId}") public TrackStatisticsDTO getTrackCount(@PathVariable String projectId) { @@ -63,10 +67,11 @@ public class TrackController { long size = trackService.countRelevanceCreatedThisWeek(projectId); statistics.setThisWeekAddedCount(size); - List coverageResults = trackService.countCoverage(projectId); - statistics.countCoverage(coverageResults); - - long total = statistics.getUncoverageCount() + statistics.getCoverageCount(); + List list = testCaseService.getTestCaseByProjectId(projectId); + long total = list.size(); + int coverage = trackService.countCoverage(projectId); + statistics.setCoverageCount(coverage); + statistics.setUncoverageCount(total - coverage); if (total != 0) { float coverageRageNumber = (float) statistics.getCoverageCount() * 100 / total; diff --git a/backend/src/main/java/io/metersphere/track/dto/TestCaseTestDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestCaseTestDTO.java new file mode 100644 index 0000000000..042bc04368 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/dto/TestCaseTestDTO.java @@ -0,0 +1,11 @@ +package io.metersphere.track.dto; + +import io.metersphere.base.domain.TestCaseTest; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class TestCaseTestDTO extends TestCaseTest { + private String testName; +} diff --git a/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java index d677de4b0b..3540c43f19 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java @@ -3,6 +3,8 @@ package io.metersphere.track.dto; import io.metersphere.base.domain.TestCaseWithBLOBs; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter @@ -18,4 +20,6 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs { private String reportId; private String model; private String projectName; + + private List list; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 56f477e3bc..937bb20ae0 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -664,8 +664,9 @@ public class TestCaseService { selecteds.forEach(id -> { test.setTestType(id.get(0)); test.setTestId(id.get(1)); - test.setId(UUID.randomUUID().toString()); test.setTestCaseId(request.getId()); + test.setCreateTime(System.currentTimeMillis()); + test.setUpdateTime(System.currentTimeMillis()); testCaseTestMapper.insert(test); }); } @@ -707,7 +708,8 @@ public class TestCaseService { selecteds.forEach(id -> { test.setTestType(id.get(0)); test.setTestId(id.get(1)); - test.setId(UUID.randomUUID().toString()); + test.setCreateTime(System.currentTimeMillis()); + test.setUpdateTime(System.currentTimeMillis()); test.setTestCaseId(request.getId()); testCaseTestMapper.insert(test); }); @@ -779,4 +781,10 @@ public class TestCaseService { } }); } + + public List getTestCaseByProjectId(String projectId) { + TestCaseExample example = new TestCaseExample(); + example.createCriteria().andProjectIdEqualTo(projectId); + return testCaseMapper.selectByExample(example); + } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index 3b103d1aaf..221fdae702 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -1,11 +1,8 @@ package io.metersphere.track.service; import com.github.pagehelper.PageHelper; -import io.metersphere.base.domain.TestPlan; -import io.metersphere.base.domain.TestPlanTestCaseExample; -import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs; -import io.metersphere.base.domain.User; -import io.metersphere.base.mapper.TestPlanTestCaseMapper; +import io.metersphere.base.domain.*; +import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; import io.metersphere.commons.constants.TestPlanTestCaseStatus; import io.metersphere.commons.user.SessionUser; @@ -14,6 +11,7 @@ import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.service.UserService; +import io.metersphere.track.dto.TestCaseTestDTO; import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; @@ -42,6 +40,14 @@ public class TestPlanTestCaseService { @Resource ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; + @Resource + private TestCaseTestMapper testCaseTestMapper; + @Resource + private LoadTestMapper loadTestMapper; + @Resource + private ApiTestCaseMapper apiTestCaseMapper; + @Resource + private ApiScenarioMapper apiScenarioMapper; public List list(QueryTestPlanCaseRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); @@ -134,7 +140,40 @@ public class TestPlanTestCaseService { } public TestPlanCaseDTO get(String testplanTestCaseId) { - return extTestPlanTestCaseMapper.get(testplanTestCaseId); + TestPlanCaseDTO testPlanCaseDTO = extTestPlanTestCaseMapper.get(testplanTestCaseId); + List testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testPlanCaseDTO.getCaseId()); + testCaseTestDTOS.forEach(dto -> { + setTestName(dto); + }); + testPlanCaseDTO.setList(testCaseTestDTOS); + return testPlanCaseDTO; + } + + private void setTestName(TestCaseTestDTO dto) { + String type = dto.getTestType(); + String id = dto.getTestId(); + switch (type) { + case "performance": + LoadTest loadTest = loadTestMapper.selectByPrimaryKey(id); + if (loadTest != null) { + dto.setTestName(loadTest.getName()); + } + break; + case "testcase": + ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(id); + if (apiTestCaseWithBLOBs != null) { + dto.setTestName(apiTestCaseWithBLOBs.getName()); + } + break; + case "automation": + ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id); + if (apiScenarioWithBLOBs != null) { + dto.setTestName(apiScenarioWithBLOBs.getName()); + } + break; + default: + break; + } } public void deleteTestCaseBath(TestPlanCaseBatchRequest request) { diff --git a/backend/src/main/java/io/metersphere/track/service/TrackService.java b/backend/src/main/java/io/metersphere/track/service/TrackService.java index f870907533..36377ea65c 100644 --- a/backend/src/main/java/io/metersphere/track/service/TrackService.java +++ b/backend/src/main/java/io/metersphere/track/service/TrackService.java @@ -80,7 +80,7 @@ public class TrackService { } } - public List countCoverage(String projectId) { + public int countCoverage(String projectId) { return extTestCaseMapper.countCoverage(projectId); } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 2fb883803f..493663be7c 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 2fb883803fa9909162ce9f6fab8a15b63af66923 +Subproject commit 493663be7c000ceef5913783788def1f43b15b2f diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index 122ecbbe44..3329cea458 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -185,6 +185,8 @@ create table test_case_test test_case_id varchar(70) null, test_id varchar(70) null, test_type varchar(70) null, + create_time bigint(13) null, + update_time bigint(13) null, constraint test_case_test_pk primary key (id) ) ENGINE = InnoDB diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index b035cc76b2..141b314e7f 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -69,7 +69,7 @@ - 环境配置 + {{ $t('api_test.definition.request.run_env') }} + diff --git a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue index c2aea0332c..0e9f8d2806 100644 --- a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue @@ -28,10 +28,10 @@
- + - +
diff --git a/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue b/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue index 54aa5e4516..2aad07e5c6 100644 --- a/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue +++ b/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue @@ -99,7 +99,7 @@ protocol: "", platforms: [ { - name: 'Metersphere', + name: 'MeterSphere', value: 'Metersphere', tip: this.$t('api_test.api_import.ms_tip'), exportTip: this.$t('api_test.api_import.ms_export_tip'), @@ -113,14 +113,14 @@ suffixes: new Set(['json']) }, { - name: 'Jmeter', + name: 'JMeter', value: 'Jmeter', tip: this.$t('api_test.api_import.jmeter_tip'), exportTip: this.$t('api_test.api_import.jmeter_export_tip'), suffixes: new Set(['jmx']) }, { - name: 'Har', + name: 'HAR', value: 'Har', tip: this.$t('api_test.api_import.har_tip'), exportTip: this.$t('api_test.api_import.har_export_tip'), diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index 5b00d2fc71..12700397ca 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -219,8 +219,12 @@ return this.selection.includes(row.id) }, open: function (variables, headers, disabled) { - this.variables = variables; - this.headers = headers; + if(variables){ + this.variables = variables; + } + if(headers){ + this.headers = headers; + } this.visible = true; this.editData = {type: "CONSTANT"}; this.addParameters(this.editData); diff --git a/frontend/src/business/components/api/definition/components/import/ApiImport.vue b/frontend/src/business/components/api/definition/components/import/ApiImport.vue index 4a21594921..e4e77933fc 100644 --- a/frontend/src/business/components/api/definition/components/import/ApiImport.vue +++ b/frontend/src/business/components/api/definition/components/import/ApiImport.vue @@ -128,7 +128,7 @@ export default { protocol: "", platforms: [ { - name: 'Metersphere', + name: 'MeterSphere', value: 'Metersphere', tip: this.$t('api_test.api_import.ms_tip'), exportTip: this.$t('api_test.api_import.ms_export_tip'), @@ -149,7 +149,7 @@ export default { suffixes: new Set(['json']) }, { - name: 'Har', + name: 'HAR', value: 'Har', tip: this.$t('api_test.api_import.har_tip'), exportTip: this.$t('api_test.api_import.har_export_tip'), diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 823a797568..6069e06e71 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -45,7 +45,7 @@ {{ scope.row.num }} {{ scope.row.num }} - +
@@ -211,548 +211,548 @@