Merge remote-tracking branch 'origin/master'

This commit is contained in:
Captain.B 2021-02-25 10:12:35 +08:00
commit e2c0bedb8d
18 changed files with 103 additions and 45 deletions

View File

@ -78,11 +78,28 @@ public class MsScenario extends MsTestElement {
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
// 场景变量
if (StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
this.setVariables(variables);
}
// 场景请求头
if (StringUtils.isNotEmpty(element.getString("headers"))) {
LinkedList<KeyValue> headers = mapper.readValue(element.getString("headers"),
new TypeReference<LinkedList<KeyValue>>() {
});
this.setHeaders(headers);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
// 设置共享cookie
config.setEnableCookieShare(enableCookieShare);
if (StringUtils.isNotEmpty(environmentId)) {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);

View File

@ -151,7 +151,7 @@ public abstract class MsTestElement {
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(element.getId());
if (apiDefinition != null) {
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {
});
@ -159,6 +159,7 @@ public abstract class MsTestElement {
}
} catch (Exception ex) {
ex.printStackTrace();
LogUtil.error(ex.getMessage());
}
}

View File

@ -35,7 +35,6 @@ import org.aspectj.util.FileUtil;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.QName;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -582,9 +581,11 @@ public class APITestService {
for (Element itemElement : sampleProxyElementList) {
if (isFromScenario) {
testName = itemElement.attributeValue(attribute_testName);
String[] testNameArr = testName.split(scenarioCaseNameSplit);
if (testNameArr.length > 0) {
testName = testNameArr[0];
if (StringUtils.isNotBlank(testName)) {
String[] testNameArr = testName.split(scenarioCaseNameSplit);
if (testNameArr.length > 0) {
testName = testNameArr[0];
}
}
}
itemElement.attribute(attribute_testName).setText(testName);

View File

@ -457,12 +457,15 @@ public class ApiAutomationService {
});
scenario.setHashTree(elements);
}
if (StringUtils.isNotEmpty(element.getString("variables"))) {
if (element != null && StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
scenario.setVariables(variables);
}
if (scenario == null) {
return null;
}
// 针对导入的jmx 处理
if (CollectionUtils.isNotEmpty(scenario.getHashTree()) && (scenario.getHashTree().get(0) instanceof MsJmeterElement)) {
scenario.toHashTree(jmeterHashTree, scenario.getHashTree(), config);
@ -879,9 +882,13 @@ public class ApiAutomationService {
// 生成jmx
List<ApiScenrioExportJmx> resList = new ArrayList<>();
apiScenarioWithBLOBs.forEach(item -> {
String jmx = generateJmx(item);
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
resList.add(scenrioExportJmx);
if (StringUtils.isNotEmpty(item.getScenarioDefinition())) {
String jmx = generateJmx(item);
if (StringUtils.isNotEmpty(jmx)) {
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
resList.add(scenrioExportJmx);
}
}
});
return resList;
}

View File

@ -391,9 +391,12 @@ public class ApiDefinitionService {
if (apiTestCase.getName().length() > 255) {
apiTestCase.setName(apiTestCase.getName().substring(0, 255));
}
if (!isInsert) {
/* if (!isInsert) {
apiTestCase.setName(apiTestCase.getName() + "_" + apiTestCase.getId().substring(0, 5));
}
}*/
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andApiDefinitionIdEqualTo(apiDefinition.getId());
apiTestCaseMapper.deleteByExample(example);
apiTestCaseMapper.insert(apiTestCase);
}
} catch (Exception e) {

View File

@ -109,9 +109,7 @@
</template>
<el-table-column fixed="right" :label="$t('commons.operating')" width="190px" v-if="!referenced">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="{row}">
<div v-if="trashEnable">
@ -193,10 +191,12 @@
getSelectDataCounts,
setUnSelectIds, toggleAllSelection
} from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "MsApiScenarioList",
components: {
HeaderLabelOperate,
HeaderCustom,
BatchMove,
EnvironmentSelect,

View File

@ -98,9 +98,7 @@
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)"
@ -164,10 +162,12 @@ import {_filter, _handleSelect, _handleSelectAll, _sort, getLabel,} from "@/comm
import {API_CASE_LIST, API_LIST, API_SCENARIO_LIST, TEST_CASE_LIST} from "@/common/js/constants";
import {Api_Case_List, Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "ApiCaseSimpleList",
components: {
HeaderLabelOperate,
ApiListContainerWithDoc,
HeaderCustom,
MsTableHeaderSelectPopover,

View File

@ -160,13 +160,13 @@
:key="index"/>
</template>
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="180"
<el-table-column fixed="right" v-if="!isReadOnly" min-width="180"
align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true"
:tip="$t('api_test.automation.execute')"
@ -243,11 +243,13 @@ import {
import {_filter, _sort} from "@/common/js/tableUtils";
import {Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "ApiList",
components: {
HeaderLabelOperate,
HeaderCustom,
CaseBatchMove,
ApiStatus,

View File

@ -49,6 +49,8 @@ export default {
props: JSON.stringify(this.fieldSelected)
}
this.$post("/system/save/header", param, response => {
console.log(this.optionalFields)
console.log(this.fieldSelected)
this.$success(this.$t("commons.save_success"));
this.dialogTableVisible = false
this.initTableData()

View File

@ -0,0 +1,25 @@
<template>
<div>
<template>
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
</div>
</template>
<script>
export default {
name: "HeaderLabelOperate",
methods: {
customHeader() {
this.$emit('exec')
}
}
}
</script>
<style scoped>
</style>

View File

@ -163,9 +163,7 @@
</template>
<el-table-column fixed="right" min-width="150">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -231,10 +229,12 @@ import BatchMove from "./BatchMove";
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import i18n from "@/i18n/i18n";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
BatchMove,
MsTableHeaderSelectPopover,

View File

@ -139,9 +139,7 @@
min-width="150"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -205,11 +203,13 @@ import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {TEST_CASE_LIST, TEST_PLAN_LIST} from "@/common/js/constants";
import {Test_Plan_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestPlanList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsDeleteConfirm,
TestCaseReportView,

View File

@ -106,9 +106,7 @@
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
@ -162,11 +160,13 @@ import {TEST_CASE_LIST, TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/cons
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Api_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestPlanApiCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
TestPlanApiCaseResult,
MsRun,

View File

@ -67,9 +67,7 @@
</template>
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="{row}">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
@ -111,10 +109,12 @@ import MsTableOperatorButton from "../../../../../common/components/MsTableOpera
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants";
import {Test_Plan_Scenario_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "MsTestPlanApiScenarioList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsTableOperatorButton,
TestPlanScenarioListHeader,

View File

@ -228,9 +228,7 @@
min-width="100"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@ -292,11 +290,13 @@ import MsTag from "@/business/components/common/components/MsTag";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "FunctionalTestCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
FunctionalTestCaseEdit,
MsTableOperatorButton,

View File

@ -102,9 +102,7 @@
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
@ -138,10 +136,12 @@ import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {getCurrentUser} from "@/common/js/utils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestPlanLoadCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
LoadCaseReport,
TestPlanLoadCaseListHeader,

View File

@ -84,9 +84,7 @@
min-width="100"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -123,10 +121,12 @@ import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableIte
import {Test_Case_Review} from "@/business/components/common/model/JsonData";
import {TEST_CASE_LIST, TEST_CASE_REVIEW_LIST} from "@/common/js/constants";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestCaseReviewList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsDeleteConfirm,
MsTableOperator,

View File

@ -153,9 +153,7 @@
:label="$t('commons.operating')"
>
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@ -215,10 +213,12 @@ import ReviewStatus from "@/business/components/track/case/components/ReviewStat
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestReviewTestCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit,