Merge branch 'master' of github.com:metersphere/metersphere
This commit is contained in:
commit
3f04d930d6
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> 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<Long> values) {
|
||||
addCriterion("create_time in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotIn(List<Long> 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<Long> values) {
|
||||
addCriterion("update_time in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotIn(List<Long> 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 {
|
||||
|
|
|
@ -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<TestCaseTest> 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);
|
||||
}
|
|
@ -1,201 +1,175 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.base.mapper.TestCaseTestMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseTest">
|
||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="test_case_id" jdbcType="VARCHAR" property="testCaseId"/>
|
||||
<result column="test_id" jdbcType="VARCHAR" property="testId"/>
|
||||
<result column="test_type" jdbcType="VARCHAR" property="testType"/>
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||
separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseTest">
|
||||
<result column="test_case_id" jdbcType="VARCHAR" property="testCaseId" />
|
||||
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
||||
<result column="test_type" jdbcType="VARCHAR" property="testType" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||
separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, test_case_id, test_id, test_type
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample"
|
||||
resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</trim>
|
||||
</if>
|
||||
<include refid="Base_Column_List"/>
|
||||
from test_case_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from test_case_test
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete
|
||||
from test_case_test
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample">
|
||||
delete from test_case_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseTest">
|
||||
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>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseTest">
|
||||
insert into test_case_test
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="testCaseId != null">
|
||||
test_case_id,
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
test_id,
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
test_type,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testCaseId != null">
|
||||
#{testCaseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
#{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
#{testType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample"
|
||||
resultType="java.lang.Long">
|
||||
select count(*) from test_case_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update test_case_test
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.testCaseId != null">
|
||||
test_case_id = #{record.testCaseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.testId != null">
|
||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.testType != null">
|
||||
test_type = #{record.testType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update test_case_test
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
test_case_id, test_id, test_type, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from test_case_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample">
|
||||
delete from test_case_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseTest">
|
||||
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>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseTest">
|
||||
insert into test_case_test
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="testCaseId != null">
|
||||
test_case_id,
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
test_id,
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
test_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="testCaseId != null">
|
||||
#{testCaseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
#{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
#{testType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample" resultType="java.lang.Long">
|
||||
select count(*) from test_case_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update test_case_test
|
||||
<set>
|
||||
<if test="record.testCaseId != null">
|
||||
test_case_id = #{record.testCaseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.testId != null">
|
||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||
test_type = #{record.testType,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseTest">
|
||||
update test_case_test
|
||||
<set>
|
||||
<if test="testCaseId != null">
|
||||
test_case_id = #{testCaseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
test_id = #{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testType != null">
|
||||
test_type = #{testType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseTest">
|
||||
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}
|
||||
</update>
|
||||
</if>
|
||||
<if test="record.testType != null">
|
||||
test_type = #{record.testType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
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}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
|
@ -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<FileMetadata> getProjectFiles(@Param("projectId") String projectId, @Param("loadTypes") List<String> loadType);
|
||||
List<FileMetadata> getProjectFiles(@Param("projectId") String projectId, @Param("loadTypes") List<String> loadType,
|
||||
@Param("request") QueryProjectFileRequest request);
|
||||
|
||||
}
|
||||
|
|
|
@ -145,5 +145,8 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
AND project_id = #{projectId,jdbcType=VARCHAR}
|
||||
<if test="request.name!=null">
|
||||
AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
|
@ -65,7 +65,7 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
long countRelevanceCreatedThisWeek(@Param("projectId") String projectId,@Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
|
||||
List<TrackCountResult> countCoverage(@Param("projectId") String projectId);
|
||||
int countCoverage(@Param("projectId") String projectId);
|
||||
|
||||
List<TrackCountResult> countFuncMaintainer(@Param("projectId") String projectId);
|
||||
|
||||
|
|
|
@ -343,17 +343,19 @@
|
|||
</select>
|
||||
|
||||
<select id="countRelevance" resultType="io.metersphere.track.response.TrackCountResult">
|
||||
SELECT type AS groupField, count(id) AS countNumber FROM test_case WHERE test_case.project_id = #{projectId} GROUP BY test_case.type
|
||||
SELECT test_case_test.test_type AS groupField, count(test_case_test.test_case_id) AS countNumber
|
||||
FROM test_case join test_case_test on test_case.id = test_case_test.test_case_id
|
||||
WHERE test_case.project_id = #{projectId} GROUP BY test_case_test.test_type
|
||||
</select>
|
||||
<select id="countRelevanceCreatedThisWeek" resultType="java.lang.Long">
|
||||
SELECT count(id) AS countNumber FROM test_case WHERE test_case.project_id = #{projectId}
|
||||
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||
SELECT count(distinct test_case_test.test_case_id) AS countNumber FROM test_case join test_case_test on test_case.id = test_case_test.test_case_id
|
||||
WHERE test_case.project_id = #{projectId}
|
||||
AND test_case_test.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||
</select>
|
||||
|
||||
<select id="countCoverage" resultType="io.metersphere.track.response.TrackCountResult">
|
||||
SELECT count(test_case.id) AS countNumber,
|
||||
if(test_case.test_id is null,"uncoverage","coverage") AS groupField
|
||||
FROM test_case WHERE test_case.project_id=#{projectId} and test_case.type != 'functional' GROUP BY groupField
|
||||
<select id="countCoverage" resultType="int">
|
||||
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)
|
||||
</select>
|
||||
<select id="countFuncMaintainer" resultType="io.metersphere.track.response.TrackCountResult">
|
||||
select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id
|
||||
|
@ -362,7 +364,7 @@
|
|||
</select>
|
||||
<select id="countRelevanceMaintainer" resultType="io.metersphere.track.response.TrackCountResult">
|
||||
select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id
|
||||
where tc.project_id = #{projectId} and tc.test_id is not null
|
||||
where tc.project_id = #{projectId} and tc.id in (select distinct test_case_test.test_case_id from test_case_test)
|
||||
group by tc.maintainer
|
||||
</select>
|
||||
<select id="getTestPlanBug" resultType="int">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||
import io.metersphere.track.dto.TestCaseTestDTO;
|
||||
import io.metersphere.track.dto.TestPlanCaseDTO;
|
||||
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -47,4 +48,6 @@ public interface ExtTestPlanTestCaseMapper {
|
|||
List<String> getExecResultByPlanId(String planId);
|
||||
|
||||
List<TestPlanCaseDTO> listForMinder(@Param("planId") String planId);
|
||||
|
||||
List<TestCaseTestDTO> listTestCaseTest(@Param("caseId") String caseId);
|
||||
}
|
||||
|
|
|
@ -421,6 +421,9 @@
|
|||
pc.plan_id = #{planId}
|
||||
</where>
|
||||
</select>
|
||||
<select id="listTestCaseTest" resultType="io.metersphere.track.dto.TestCaseTestDTO">
|
||||
select * from test_case_test where test_case_id = #{caseId};
|
||||
</select>
|
||||
|
||||
<update id="updateTestCaseStates" parameterType="java.lang.String">
|
||||
update test_plan_test_case
|
||||
|
|
|
@ -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<List<FileMetadata>> 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<Object> 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")
|
||||
|
|
|
@ -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<JSONObject> 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;
|
||||
|
|
|
@ -4,5 +4,5 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class QueryProjectFileRequest {
|
||||
private String filename;
|
||||
private String name;
|
||||
}
|
||||
|
|
|
@ -561,19 +561,23 @@ public class PerformanceTestService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<FileMetadata> getProjectFiles(String projectId, String loadType) {
|
||||
public List<FileMetadata> getProjectFiles(String projectId, String loadType, QueryProjectFileRequest request) {
|
||||
List<String> loadTypes = new ArrayList<>();
|
||||
loadTypes.add(StringUtils.upperCase(loadType));
|
||||
if (StringUtils.equalsIgnoreCase(loadType, "resource")) {
|
||||
loadTypes.add(FileType.CSV.name());
|
||||
loadTypes.add(FileType.JAR.name());
|
||||
List<String> 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<String> 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<LoadTestExportJmx> exportJmx(List<String> fileIds) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<TrackCountResult> coverageResults = trackService.countCoverage(projectId);
|
||||
statistics.countCoverage(coverageResults);
|
||||
|
||||
long total = statistics.getUncoverageCount() + statistics.getCoverageCount();
|
||||
List<TestCase> 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;
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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<TestCaseTestDTO> list;
|
||||
}
|
||||
|
|
|
@ -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<TestCase> getTestCaseByProjectId(String projectId) {
|
||||
TestCaseExample example = new TestCaseExample();
|
||||
example.createCriteria().andProjectIdEqualTo(projectId);
|
||||
return testCaseMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TestPlanCaseDTO> 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<TestCaseTestDTO> 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) {
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TrackService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<TrackCountResult> countCoverage(String projectId) {
|
||||
public int countCoverage(String projectId) {
|
||||
return extTestCaseMapper.countCoverage(projectId);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2fb883803fa9909162ce9f6fab8a15b63af66923
|
||||
Subproject commit 493663be7c000ceef5913783788def1f43b15b2f
|
|
@ -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
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<el-table-column v-if="item.id == 'tags'" prop="tags" min-width="120px"
|
||||
:label="$t('api_test.automation.tag')" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
|
||||
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" :show-tooltip="true" tooltip style="margin-left: 5px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.id == 'userId'" prop="userId" min-width="120px"
|
||||
|
@ -758,7 +758,6 @@
|
|||
z-index: auto !important;
|
||||
}
|
||||
|
||||
|
||||
/deep/ .el-table__fixed-right {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<env-select :project-ids="projectIds" :env-map="envMap" @close="visible = false"
|
||||
ref="envSelect" @setProjectEnvMap="setProjectEnvMap" :project-list="projectList"/>
|
||||
<el-button type="primary" slot="reference" size="mini" style="margin-top: 2px;">
|
||||
环境配置<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||
{{ $t('api_test.definition.request.run_env') }}
|
||||
<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||
</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
<div class="header-right" @click.stop>
|
||||
<slot name="message"></slot>
|
||||
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
|
||||
<el-switch v-model="data.enable" class="enable-switch" size="mini"/>
|
||||
<el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled"/>
|
||||
</el-tooltip>
|
||||
<slot name="button"></slot>
|
||||
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn"/>
|
||||
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn && !data.disabled"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -44,12 +44,12 @@ export default {
|
|||
component: () => import('@/business/components/api/report/ApiReportView'),
|
||||
},
|
||||
{
|
||||
path: "definition",
|
||||
path: "definition/:redirectID?/:dataType?/:dataSelectRange?",
|
||||
name: "ApiDefinition",
|
||||
component: () => import('@/business/components/api/definition/ApiDefinition'),
|
||||
},
|
||||
{
|
||||
path: "automation",
|
||||
path: "automation/:redirectID?/:dataType?/:dataSelectRange?",
|
||||
name: "ApiAutomation",
|
||||
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
||||
},
|
||||
|
|
|
@ -1,28 +1,36 @@
|
|||
<template>
|
||||
<el-tag :type="type" :effect="effect" :color="color" size="mini">{{content}}</el-tag>
|
||||
<el-tooltip placement="top" v-if="showTooltip">
|
||||
<div slot="content">{{content}}</div>
|
||||
<el-tag :type="type" :effect="effect" :color="color" size="mini">{{content}}</el-tag>
|
||||
</el-tooltip>
|
||||
<el-tag :type="type" :effect="effect" :color="color" size="mini" v-else>{{content}}</el-tag>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "MsTag",
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
content: {
|
||||
type: String
|
||||
},
|
||||
effect: {
|
||||
type: String,
|
||||
default: 'dark',
|
||||
}
|
||||
export default {
|
||||
name: "MsTag",
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
content: {
|
||||
type: String
|
||||
},
|
||||
effect: {
|
||||
type: String,
|
||||
default: 'dark',
|
||||
},
|
||||
showTooltip: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -3,42 +3,42 @@
|
|||
:destroy-on-close="true"
|
||||
:title="$t('load_test.exist_jmx')" width="70%"
|
||||
:visible.sync="loadFileVisible">
|
||||
<el-row>
|
||||
|
||||
<el-upload
|
||||
v-if="loadType === 'jmx'"
|
||||
style="padding-right: 10px;"
|
||||
accept=".jmx"
|
||||
action=""
|
||||
multiple
|
||||
:limit="fileNumLimit"
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUploadFile"
|
||||
:http-request="handleUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:disabled="isReadOnly"
|
||||
:file-list="fileList">
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('load_test.upload_jmx')"/>
|
||||
</el-upload>
|
||||
<el-upload
|
||||
v-else
|
||||
style="padding-right: 10px;"
|
||||
accept=".jar,.csv,.json,.pdf,.jpg,.png,.jpeg,.doc,.docx,.xlsx"
|
||||
action=""
|
||||
:limit="fileNumLimit"
|
||||
multiple
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUploadFile"
|
||||
:http-request="handleUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:disabled="isReadOnly"
|
||||
:file-list="fileList">
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('load_test.upload_file')"/>
|
||||
</el-upload>
|
||||
</el-row>
|
||||
|
||||
<ms-table-header :is-tester-permission="true" title="" :condition.sync="condition" @search="getProjectFiles" :show-create="false">
|
||||
<template v-slot:button>
|
||||
<el-upload
|
||||
v-if="loadType === 'jmx'"
|
||||
style="margin-bottom: 10px"
|
||||
accept=".jmx"
|
||||
action=""
|
||||
multiple
|
||||
:limit="fileNumLimit"
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUploadFile"
|
||||
:http-request="handleUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:disabled="isReadOnly"
|
||||
:file-list="fileList">
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('load_test.upload_jmx')"/>
|
||||
</el-upload>
|
||||
<el-upload
|
||||
v-else
|
||||
style="margin-bottom: 10px"
|
||||
accept=".jar,.csv,.json,.pdf,.jpg,.png,.jpeg,.doc,.docx,.xlsx"
|
||||
action=""
|
||||
:limit="fileNumLimit"
|
||||
multiple
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUploadFile"
|
||||
:http-request="handleUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:disabled="isReadOnly"
|
||||
:file-list="fileList">
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('load_test.upload_file')"/>
|
||||
</el-upload>
|
||||
</template>
|
||||
</ms-table-header>
|
||||
<el-table v-loading="projectLoadingResult.loading"
|
||||
class="basic-config"
|
||||
:data="existFiles"
|
||||
|
@ -78,10 +78,11 @@ import {getCurrentProjectID} from "@/common/js/utils";
|
|||
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
|
||||
import MsTableButton from "@/business/components/common/components/MsTableButton";
|
||||
import axios from "axios";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
|
||||
export default {
|
||||
name: "ExistFiles",
|
||||
components: {MsTableButton, MsTablePagination, MsDialogFooter},
|
||||
components: {MsTableHeader, MsTableButton, MsTablePagination, MsDialogFooter},
|
||||
props: {
|
||||
fileList: Array,
|
||||
tableData: Array,
|
||||
|
@ -100,6 +101,7 @@ export default {
|
|||
existFiles: [],
|
||||
selectIds: new Set,
|
||||
fileNumLimit: 10,
|
||||
condition: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -133,7 +135,7 @@ export default {
|
|||
}
|
||||
},
|
||||
getProjectFiles() {
|
||||
this.projectLoadingResult = this.$get('/performance/project/' + this.loadType + '/' + getCurrentProjectID() + "/" + this.currentPage + "/" + this.pageSize, res => {
|
||||
this.projectLoadingResult = this.$post('/performance/project/' + this.loadType + '/' + getCurrentProjectID() + "/" + this.currentPage + "/" + this.pageSize, this.condition, res => {
|
||||
let data = res.data;
|
||||
this.total = data.itemCount;
|
||||
this.existFiles = data.listObject;
|
||||
|
|
|
@ -329,10 +329,10 @@ export default {
|
|||
}
|
||||
return true;
|
||||
},
|
||||
beforeUploadJmx(file){
|
||||
beforeUploadJmx(file) {
|
||||
this.$refs.existFiles.beforeUploadFile(file);
|
||||
},
|
||||
handleUpload(file){
|
||||
handleUpload(file) {
|
||||
this.$refs.existFiles.handleUpload(file);
|
||||
},
|
||||
},
|
||||
|
@ -341,7 +341,7 @@ export default {
|
|||
|
||||
<style scoped>
|
||||
.basic-config {
|
||||
width: 100%
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.last-modified {
|
||||
|
|
|
@ -3,22 +3,25 @@
|
|||
:destroy-on-close="true"
|
||||
:title="$t('load_test.exist_jmx')" width="70%"
|
||||
:visible.sync="loadFileVisible">
|
||||
<el-row>
|
||||
<el-upload
|
||||
style="padding-right: 10px;"
|
||||
accept=".jmx,.jar,.csv,.json,.pdf,.jpg,.png,.jpeg,.doc,.docx,.xlsx"
|
||||
action=""
|
||||
:limit="fileNumLimit"
|
||||
multiple
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUploadFile"
|
||||
:http-request="handleUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList">
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('load_test.upload_file')"/>
|
||||
</el-upload>
|
||||
</el-row>
|
||||
|
||||
<ms-table-header :is-tester-permission="true" title="" :condition.sync="condition" @search="getProjectFiles" :show-create="false">
|
||||
<template v-slot:button>
|
||||
<el-upload
|
||||
style="margin-bottom: 10px;"
|
||||
accept=".jmx,.jar,.csv,.json,.pdf,.jpg,.png,.jpeg,.doc,.docx,.xlsx"
|
||||
action=""
|
||||
:limit="fileNumLimit"
|
||||
multiple
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUploadFile"
|
||||
:http-request="handleUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList">
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('load_test.upload_file')"/>
|
||||
</el-upload>
|
||||
</template>
|
||||
</ms-table-header>
|
||||
|
||||
<el-table v-loading="projectLoadingResult.loading"
|
||||
class="basic-config"
|
||||
|
@ -64,10 +67,12 @@ import MsDialogFooter from "@/business/components/common/components/MsDialogFoot
|
|||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
|
||||
import {Message} from "element-ui";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
import MsTableSearchBar from "@/business/components/common/components/MsTableSearchBar";
|
||||
|
||||
export default {
|
||||
name: "MsResourceFiles",
|
||||
components: {MsTableOperatorButton, MsDialogFooter, MsTableButton, MsTablePagination},
|
||||
components: {MsTableSearchBar, MsTableHeader, MsTableOperatorButton, MsDialogFooter, MsTableButton, MsTablePagination},
|
||||
data() {
|
||||
return {
|
||||
loadFileVisible: false,
|
||||
|
@ -79,6 +84,7 @@ export default {
|
|||
fileList: [],
|
||||
uploadList: [],
|
||||
fileNumLimit: 10,
|
||||
condition: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -91,7 +97,7 @@ export default {
|
|||
this.selectIds.clear();
|
||||
},
|
||||
getProjectFiles() {
|
||||
this.projectLoadingResult = this.$get('/performance/project/all/' + getCurrentProjectID() + "/" + this.currentPage + "/" + this.pageSize, res => {
|
||||
this.projectLoadingResult = this.$post('/performance/project/all/' + getCurrentProjectID() + "/" + this.currentPage + "/" + this.pageSize, this.condition, res => {
|
||||
let data = res.data;
|
||||
this.total = data.itemCount;
|
||||
this.existFiles = data.listObject;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
<el-tab-pane name="default" :label="$t('api_test.definition.case_title')">
|
||||
<ms-tab-button
|
||||
:active-dom.sync="activeDom"
|
||||
:left-tip="$t('api_test.definition.case_title')"
|
||||
:left-content="'CASE'"
|
||||
:left-tip="$t('test_track.case.list')"
|
||||
:left-content="$t('test_track.case.list')"
|
||||
:right-tip="$t('test_track.case.minder')"
|
||||
:right-content="$t('test_track.case.minder')"
|
||||
:middle-button-enable="false">
|
||||
|
|
|
@ -85,6 +85,15 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :offset="1">
|
||||
<span class="cast_label">关联测试:</span>
|
||||
<span v-for="(item,index) in testCase.list" :key="index">
|
||||
<el-button @click="openTest(item)" type="text" style="margin-left: 7px;">{{ item.testName }}</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :offset="1">
|
||||
<span class="cast_label">{{ $t('test_track.case.prerequisite') }}:</span>
|
||||
|
@ -351,7 +360,7 @@ import ApiTestDetail from "../test/ApiTestDetail";
|
|||
import ApiTestResult from "../test/ApiTestResult";
|
||||
import PerformanceTestDetail from "../test/PerformanceTestDetail";
|
||||
import PerformanceTestResult from "../test/PerformanceTestResult";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||
import CaseComment from "@/business/components/track/case/components/CaseComment";
|
||||
import MsPreviousNextButton from "../../../../../common/components/MsPreviousNextButton";
|
||||
|
@ -559,6 +568,29 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
openTest(item) {
|
||||
const type = item.testType;
|
||||
const id = item.testId;
|
||||
switch (type) {
|
||||
case "performance": {
|
||||
let performanceData = this.$router.resolve({
|
||||
path: '/performance/test/edit/' + id,
|
||||
})
|
||||
window.open(performanceData.href, '_blank');
|
||||
break;
|
||||
}
|
||||
case "testcase": {
|
||||
let caseData = this.$router.resolve({name:'ApiDefinition',params:{redirectID:getUUID(),dataType:"apiTestCase",dataSelectRange:'single:'+id}});
|
||||
window.open(caseData.href, '_blank');
|
||||
break;
|
||||
}
|
||||
case "automation": {
|
||||
let automationData = this.$router.resolve({name:'ApiAutomation',params:{redirectID:getUUID(),dataType:"scenario",dataSelectRange:'edit:'+id}});
|
||||
window.open(automationData.href, '_blank');
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
getRelatedTest() {
|
||||
if (this.testCase.method === 'auto' && this.testCase.testId && this.testCase.testId !== 'other') {
|
||||
this.$get('/' + this.testCase.type + '/get/' + this.testCase.testId, response => {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<template v-slot:main>
|
||||
<ms-tab-button
|
||||
:active-dom.sync="activeDom"
|
||||
:left-tip="$t('api_test.definition.case_title')"
|
||||
:left-content="'CASE'"
|
||||
:left-tip="$t('test_track.case.list')"
|
||||
:left-content="$t('test_track.case.list')"
|
||||
:right-tip="$t('test_track.case.minder')"
|
||||
:right-content="$t('test_track.case.minder')"
|
||||
:middle-button-enable="false">
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<template v-slot:main>
|
||||
<ms-tab-button
|
||||
:active-dom.sync="activeDom"
|
||||
:left-tip="$t('api_test.definition.case_title')"
|
||||
:left-content="'CASE'"
|
||||
:left-tip="$t('test_track.case.list')"
|
||||
:left-content="$t('test_track.case.list')"
|
||||
:right-tip="$t('test_track.case.minder')"
|
||||
:right-content="$t('test_track.case.minder')"
|
||||
:middle-button-enable="false">
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3dbd5a3d7ec96a10e11d817cdec25832986af1d2
|
||||
Subproject commit f63ebb68ebad78de42fd711f17e2671e34577a86
|
|
@ -327,7 +327,7 @@ export default {
|
|||
use_tip_tapd: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"',
|
||||
use_tip_jira: 'Jira software server authentication information is account password, Jira software cloud authentication information is account + token (account settings-security-create API token)',
|
||||
use_tip_zentao: 'The account password is a Zentao account with corresponding permissions, and the account needs to have super model calling interface permissions',
|
||||
use_tip_two: 'After saving the Basic Auth account information, you need to manually associate the ID/key in the Metersphere project',
|
||||
use_tip_two: 'After saving the Basic Auth account information, you need to manually associate the ID/key in the MeterSphere project',
|
||||
link_the_project_now: 'Link the project now',
|
||||
cancel_edit: 'Cancel edit',
|
||||
cancel_integration: 'Cancel integration',
|
||||
|
@ -437,7 +437,7 @@ export default {
|
|||
downloadJtl: 'Download JTL',
|
||||
test_execute_again: 'Test Execute Again',
|
||||
export: 'Export',
|
||||
export_to_ms_format: 'Export to Metersphere format',
|
||||
export_to_ms_format: 'Export to MeterSphere format',
|
||||
export_to_swagger3_format: 'Export to Swagger3.0 format',
|
||||
compare: 'Compare',
|
||||
generation_error: 'Report generation error, unable to view, please check log details!',
|
||||
|
@ -809,7 +809,7 @@ export default {
|
|||
url_description: "etc: https://fit2cloud.com",
|
||||
path_description: "etc:/login",
|
||||
parameters: "Query parameters",
|
||||
jmeter_func: "Jmeter Functions",
|
||||
jmeter_func: "JMeter Functions",
|
||||
parameters_filter_example: "Example",
|
||||
parameters_filter_tips: "Only support MockJs function result preview",
|
||||
parameters_advance: "Advanced parameter settings",
|
||||
|
@ -1126,6 +1126,7 @@ export default {
|
|||
cancel_relevance_success: "Unlinked successfully",
|
||||
switch_project: "Switch project",
|
||||
case: {
|
||||
list: "List",
|
||||
minder: "Minder",
|
||||
check_select: "Please check the case",
|
||||
export_all_cases: 'Are you sure you want to export all use cases?',
|
||||
|
|
|
@ -325,7 +325,7 @@ export default {
|
|||
use_tip_tapd: 'Tapd Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询',
|
||||
use_tip_jira: 'Jira software server 认证信息为 账号密码,Jira software cloud 认证信息为 账号+令牌(账户设置-安全-创建API令牌)',
|
||||
use_tip_zentao: '账号密码为具有相应权限的Zentao账号,账号需要具有 超级model调用接口权限',
|
||||
use_tip_two: '保存 Basic Auth 账号信息后,需要在 Metersphere 项目中手动关联 ID/key',
|
||||
use_tip_two: '保存 Basic Auth 账号信息后,需要在 MeterSphere 项目中手动关联 ID/key',
|
||||
link_the_project_now: '马上关联项目',
|
||||
cancel_edit: '取消编辑',
|
||||
cancel_integration: '取消集成',
|
||||
|
@ -435,7 +435,7 @@ export default {
|
|||
test_execute_again: '再次执行',
|
||||
downloadJtl: '下载JTL',
|
||||
export: '导出',
|
||||
export_to_ms_format: '导出 Metersphere 格式',
|
||||
export_to_ms_format: '导出 MeterSphere 格式',
|
||||
export_to_swagger3_format: '导出 Swagger3.0 格式',
|
||||
compare: '比较',
|
||||
generation_error: '报告生成错误, 无法查看, 请检查日志详情!',
|
||||
|
@ -810,7 +810,7 @@ export default {
|
|||
path_description: "例如:/login",
|
||||
url_invalid: "URL无效",
|
||||
parameters: "Query参数",
|
||||
jmeter_func: "Jmeter 方法",
|
||||
jmeter_func: "JMeter 方法",
|
||||
parameters_filter_example: "示例",
|
||||
parameters_filter_tips: "只支持 MockJs 函数结果预览",
|
||||
parameters_advance: "return",
|
||||
|
@ -946,16 +946,16 @@ export default {
|
|||
file_size_limit: "文件大小不超过 20 M",
|
||||
tip: "说明",
|
||||
export_tip: "导出方法",
|
||||
ms_tip: "支持 Metersphere json 格式",
|
||||
ms_export_tip: "通过 Metersphere 接口测试页面或者浏览器插件导出 json 格式文件",
|
||||
ms_tip: "支持 MeterSphere json 格式",
|
||||
ms_export_tip: "通过 MeterSphere 接口测试页面或者浏览器插件导出 json 格式文件",
|
||||
har_export_tip: "通过 浏览器的开发者工具 导出 Har 格式文件",
|
||||
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
|
||||
swagger_tip: "支持 Swagger 2.0 与 3.0 版本的 json 文件",
|
||||
har_tip: "只支持 Har 文件",
|
||||
post_export_tip: "通过 Postman 导出测试集合",
|
||||
swagger_export_tip: "通过 Swagger 页面导出",
|
||||
jmeter_export_tip: "通过 Jmeter 生成JMX文件",
|
||||
jmeter_tip: "支持 Jmeter 5.2版本的JMX 文件",
|
||||
jmeter_export_tip: "通过 JMeter 生成JMX文件",
|
||||
jmeter_tip: "支持 JMeter 5.2版本的JMX 文件",
|
||||
suffixFormatErr: "文件格式不符合要求",
|
||||
swagger_url_import: "使用URL导入",
|
||||
timing_synchronization: "定时同步",
|
||||
|
@ -1130,6 +1130,7 @@ export default {
|
|||
cancel_relevance_success: "取消关联成功",
|
||||
switch_project: "切换项目",
|
||||
case: {
|
||||
list: "列表",
|
||||
minder: "脑图",
|
||||
check_select: "请勾选用例",
|
||||
export_all_cases: '确定要导出全部用例吗?',
|
||||
|
|
|
@ -325,7 +325,7 @@ export default {
|
|||
use_tip_tapd: 'Tapd Basic Auth 賬號信息在"公司管理-安全與集成-開放平臺"中查詢',
|
||||
use_tip_jira: 'Jira software server 認證信息為 賬號密碼,Jira software cloud 認證信息為 賬號+令牌(賬戶設置-安全-創建API令牌)',
|
||||
use_tip_zentao: '賬號密碼為具有相應權限的Zentao賬號,賬號需要具有 超級model調用接口權限',
|
||||
use_tip_two: '保存 Basic Auth 賬號信息後,需要在 Metersphere 項目中手動關聯 ID/key',
|
||||
use_tip_two: '保存 Basic Auth 賬號信息後,需要在 MeterSphere 項目中手動關聯 ID/key',
|
||||
link_the_project_now: '馬上關聯項目',
|
||||
cancel_edit: '取消編輯',
|
||||
cancel_integration: '取消集成',
|
||||
|
@ -435,7 +435,7 @@ export default {
|
|||
test_execute_again: '再次執行',
|
||||
downloadJtl: '下載JTL',
|
||||
export: '導出',
|
||||
export_to_ms_format: '導出 Metersphere 格式',
|
||||
export_to_ms_format: '導出 MeterSphere 格式',
|
||||
export_to_swagger3_format: '導出 Swagger3.0 格式',
|
||||
compare: '比較',
|
||||
generation_error: '報告生成錯誤, 無法查看, 請檢查日誌詳情!',
|
||||
|
@ -809,7 +809,7 @@ export default {
|
|||
path_description: "例如:/login",
|
||||
url_invalid: "URL無效",
|
||||
parameters: "Query參數",
|
||||
jmeter_func: "Jmeter 方法",
|
||||
jmeter_func: "JMeter 方法",
|
||||
parameters_filter_example: "示例",
|
||||
parameters_filter_tips: "只支持 MockJs 函數結果預覽",
|
||||
parameters_advance: "高級參數設置",
|
||||
|
@ -945,16 +945,16 @@ export default {
|
|||
file_size_limit: "文件大小不超過 20 M",
|
||||
tip: "說明",
|
||||
export_tip: "導出方法",
|
||||
ms_tip: "支持 Metersphere json 格式",
|
||||
ms_export_tip: "通過 Metersphere 接口測試頁面或者瀏覽器插件導出 json 格式文件",
|
||||
ms_tip: "支持 MeterSphere json 格式",
|
||||
ms_export_tip: "通過 MeterSphere 接口測試頁面或者瀏覽器插件導出 json 格式文件",
|
||||
har_export_tip: "通过 瀏覽器到開發者工具 导出 Har 格式文件",
|
||||
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
|
||||
swagger_tip: "支持 Swagger 2.0 與 3.0 版本的 json 文件",
|
||||
har_tip: "只支持 Har 文件",
|
||||
post_export_tip: "通過 Postman 導出測試集合",
|
||||
swagger_export_tip: "通過 Swagger 頁面導出",
|
||||
jmeter_export_tip: "通過 Jmeter 生成JMX文件",
|
||||
jmeter_tip: "支持 Jmeter 5.2版本的JMX 文件",
|
||||
jmeter_export_tip: "通過 JMeter 生成JMX文件",
|
||||
jmeter_tip: "支持 JMeter 5.2版本的JMX 文件",
|
||||
suffixFormatErr: "文件格式不符合要求",
|
||||
swagger_url_import: "使用URL導入",
|
||||
timing_synchronization: "定時同步",
|
||||
|
@ -1128,6 +1128,7 @@ export default {
|
|||
cancel_relevance_success: "取消關聯成功",
|
||||
switch_project: "切換項目",
|
||||
case: {
|
||||
list: "列表",
|
||||
minder: "腦圖",
|
||||
check_select: "請勾選用例",
|
||||
export_all_cases: '確定要導出全部用例嗎?',
|
||||
|
|
Loading…
Reference in New Issue