refactor(性能测试): 引入自动化场景显示csv等文件

This commit is contained in:
Captain.B 2021-06-28 13:14:44 +08:00 committed by 刘瑞斌
parent df9f214b19
commit ab44bd0183
2 changed files with 16 additions and 10 deletions

View File

@ -21,7 +21,8 @@
<el-table-column prop="tags" min-width="120px"
:label="$t('api_test.automation.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName"
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName"
style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
@ -66,7 +67,7 @@ export default {
total: 0,
apiScenarios: [],
selectIds: new Set,
}
};
},
methods: {
open() {
@ -101,7 +102,7 @@ export default {
let condition = {
projectId: getCurrentProjectID(),
filters: {status: ["Prepare", "Underway", "Completed"]}
}
};
this.projectLoadingResult = this.$post('/api/automation/list/' + this.currentPage + "/" + this.pageSize, condition, res => {
let data = res.data;
this.total = data.itemCount;
@ -111,7 +112,7 @@ export default {
item.tags = JSON.parse(item.tags);
}
});
})
});
},
handleImport() {
if (this.selectIds.size === 0) {
@ -133,7 +134,7 @@ export default {
let data = response.data;
data.forEach(d => {
let jmxName = d.name + "_" + new Date().getTime() + ".jmx";
let threadGroups = findThreadGroup(d.jmx, jmxName)
let threadGroups = findThreadGroup(d.jmx, jmxName);
threadGroups.forEach(tg => {
tg.options = {};
this.scenarios.push(tg);
@ -146,16 +147,21 @@ export default {
type: 'JMX',
updateTime: file.lastModified,
});
})
// csv
d.fileMetadataList?.forEach(f => {
this.fileList.push(f);
this.tableData.push(f);
});
});
this.$emit('fileChange', this.scenarios);
this.$success(this.$t('test_track.case.import.success'));
this.loadApiAutomationVisible = false;
})
});
this.selectIds.clear();
},
}
}
};
</script>
<style scoped>

View File

@ -295,8 +295,8 @@ export default {
csvFiles() {
if (this.csvConfig && this.csvFiles) {
this.csvFiles.forEach(f => {
f.csvSplit = this.csvConfig[f.name].csvSplit;
f.csvHasHeader = this.csvConfig[f.name].csvHasHeader;
f.csvSplit = this.csvConfig[f.name]?.csvSplit;
f.csvHasHeader = this.csvConfig[f.name]?.csvHasHeader;
});
}
}