This commit is contained in:
shiziyuan9527 2020-08-18 18:47:32 +08:00
commit 744e1fd7c2
15 changed files with 236 additions and 20 deletions

1
backend/.gitignore vendored
View File

@ -32,3 +32,4 @@ target
.project
.classpath
.factorypath
*.jar

View File

@ -369,6 +369,16 @@
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/jmeter/lib/**/*.jar</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
@ -396,6 +406,35 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_functions</artifactId>
<version>${jmeter.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>src/main/resources/jmeter/lib/ext</outputDirectory>
<destFileName>ApacheJMeter_functions.jar</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/wars</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>

@ -1 +1 @@
Subproject commit b86032cbbda9a9e6028308aa95a887cff2192f1c
Subproject commit 8eff343619df1572e1cded52f173257ef4b518a1

View File

@ -118,7 +118,6 @@ test_case_already_exists_excel=There are duplicate test cases in the import file
test_case_module_already_exists=The module name already exists at the same level
api_test_name_already_exists=Test name already exists
functional_method_tip=Functional test not support auto method
#ldap
ldap_url_is_null=LDAP address is empty
ldap_dn_is_null=LDAP binding DN is empty
@ -137,3 +136,9 @@ login_fail_ou_error=Login failed, please check the user OU
login_fail_filter_error=Login failed, please check the user filter
check_ldap_mapping=Check LDAP attribute mapping
ldap_mapping_value_null=LDAP user attribute mapping field is empty
#quota
quota_workspace_excess_org_api=The total number of interface tests in the workspace cannot exceed the organization's quota
quota_workspace_excess_org_performance=The total number of performance tests for the workspace cannot exceed the organization's quota
quota_workspace_excess_org_max_threads=The maximum concurrent number of workspaces cannot exceed the quota of the organization
quota_workspace_excess_org_max_duration=The stress test duration of the workspace cannot exceed the organization's quota
quota_workspace_excess_org_resource_pool=The resource pool of the workspace cannot exceed the resource pool of the organization

View File

@ -118,7 +118,6 @@ test_case_already_exists_excel=导入文件中存在重复用例
test_case_module_already_exists=同层级下已存在该模块名称
api_test_name_already_exists=测试名称已经存在
functional_method_tip=功能测试不支持自动方式
#ldap
ldap_url_is_null=LDAP地址为空
ldap_dn_is_null=LDAP绑定DN为空
@ -137,5 +136,12 @@ login_fail_ou_error=登录失败请检查用户OU
login_fail_filter_error=登录失败,请检查用户过滤器
check_ldap_mapping=检查LDAP属性映射
ldap_mapping_value_null=LDAP用户属性映射字段为空值
#quota
quota_workspace_excess_org_api=工作空间的接口测试数量总和不能超过组织的配额
quota_workspace_excess_org_performance=工作空间的性能测试数量总和不能超过组织的配额
quota_workspace_excess_org_max_threads=工作空间的最大并发数不能超过组织的配额
quota_workspace_excess_org_max_duration=工作空间的压测时长不能超过组织的配额
quota_workspace_excess_org_resource_pool=工作空间的资源池不能超过组织的资源池范围

View File

@ -118,7 +118,6 @@ test_case_already_exists_excel=導入文件中存在重復用例
test_case_module_already_exists=同層級下已存在該模塊名稱
api_test_name_already_exists=測試名稱已經存在
functional_method_tip=功能測試不支持自動方式
#ldap
ldap_url_is_null=LDAP地址為空
ldap_dn_is_null=LDAP綁定DN為空
@ -137,3 +136,9 @@ login_fail_ou_error=登錄失敗請檢查用戶OU
login_fail_filter_error=登錄失敗,請檢查用戶過濾器
check_ldap_mapping=檢查LDAP屬性映射
ldap_mapping_value_null=LDAP用戶屬性映射預設為空值
#quota
quota_workspace_excess_org_api=工作空間的接口測試數量總和不能超過組織的配額
quota_workspace_excess_org_performance=工作空間的性能測試數量總和不能超過組織的配額
quota_workspace_excess_org_max_threads=工作空間的最大並發數不能超過組織的配額
quota_workspace_excess_org_max_duration=工作空間的壓測時長不能超過組織的配額
quota_workspace_excess_org_resource_pool=工作空間的資源池不能超過組織的資源池範圍

View File

@ -1,16 +1,54 @@
<template>
<div class="script-content">
<ms-code-edit mode="java" :read-only="isReadOnly" :data.sync="beanShellProcessor.script" theme="eclipse" :modes="['java']" ref="codeEdit"/>
<div >
<el-row>
<el-col :span="22" class="script-content">
<ms-code-edit v-if="isCodeEditAlive" mode="java" :read-only="isReadOnly" :data.sync="beanShellProcessor.script" theme="eclipse" :modes="['java']" ref="codeEdit"/>
</el-col>
<el-col :span="2" class="script-index">
<div class="template-title">{{$t('api_test.request.processor.code_template')}}</div>
<div v-for="(template, index) in codeTemplates" :key="index" class="code-template">
<el-link @click="addTemplate(template)">{{template.title}}</el-link>
</div>
<div class="document-url">
<el-link href="https://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor" type="primary">{{$t('commons.reference_documentation')}}</el-link>
<ms-instructions-icon :content="$t('api_test.request.processor.bean_shell_processor_tip')"/>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
export default {
name: "MsBeanShellProcessor",
components: {MsCodeEdit},
components: {MsInstructionsIcon, MsCodeEdit},
data() {
return {
codeTemplates: [
{
title: this.$t('api_test.request.processor.code_template_get_variable'),
value: 'vars.get("variable_name");'
},
{
title: this.$t('api_test.request.processor.code_template_set_variable'),
value: 'vars.put("variable_name", "variable_value");'
},
{
title: this.$t('api_test.request.processor.code_template_get_response_header'),
value: 'prev.getResponseHeaders();'
},
{
title: this.$t('api_test.request.processor.code_template_get_response_code'),
value: 'prev.getResponseCode();'
},
{
title: this.$t('api_test.request.processor.code_template_get_response_result'),
value: 'prev.getResponseDataAsString();'
}
],
isCodeEditAlive: true
}
},
props: {
@ -25,6 +63,16 @@
type: Object,
}
},
methods: {
addTemplate(template) {
this.beanShellProcessor.script += template.value;
this.reload();
},
reload() {
this.isCodeEditAlive = false;
this.$nextTick(() => (this.isCodeEditAlive = true));
}
}
}
</script>
@ -35,8 +83,28 @@
}
.script-content {
padding: 15px 0;
height: 300px;
height: calc(100vh - 570px);
}
.script-index {
padding: 0 20px;
}
.script-index div:first-child {
font-weight: bold;
font-size: 15px;
}
.template-title {
margin-bottom: 5px;
}
.document-url {
margin-top: 10px;
}
.instructions-icon {
margin-left: 5px;
}
</style>

View File

@ -68,10 +68,10 @@
<el-tab-pane :label="$t('api_test.request.extract.label')" name="extract">
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
</el-tab-pane>
<el-tab-pane :label="'预执行脚本'" name="beanShellPreProcessor">
<el-tab-pane :label="$t('api_test.request.processor.pre_exec_script')" name="beanShellPreProcessor">
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPreProcessor"/>
</el-tab-pane>
<el-tab-pane :label="'后执行脚本'" name="beanShellPostProcessor">
<el-tab-pane :label="$t('api_test.request.processor.post_exec_script')" name="beanShellPostProcessor">
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPostProcessor"/>
</el-tab-pane>
</el-tabs>

View File

@ -423,10 +423,7 @@ export class BeanShellPreProcessor extends BeanShellProcessor {
}
export class BeanShellPostProcessor extends BeanShellProcessor {
constructor(testName, script) {
let processor = {
script: script,
};
constructor(testName, processor) {
super('BeanShellPostProcessor', 'TestBeanGUI', 'BeanShellPostProcessor', testName, processor)
}
}

View File

@ -1,5 +1,5 @@
import {
Arguments, BeanShellPreProcessor,
Arguments, BeanShellPostProcessor, BeanShellPreProcessor,
CookieManager,
DubboSample,
DurationAssertion,
@ -906,7 +906,7 @@ class JMXGenerator {
httpSamplerProxy.put(new BeanShellPreProcessor(name, request.beanShellPreProcessor));
}
if (request.beanShellPostProcessor && request.beanShellPostProcessor.script) {
httpSamplerProxy.put(new BeanShellPreProcessor(name, request.beanShellPostProcessor));
httpSamplerProxy.put(new BeanShellPostProcessor(name, request.beanShellPostProcessor));
}
}

View File

@ -0,0 +1,53 @@
<template>
<el-tooltip class="instructions-icon" :effect="effect" :placement="placement">
<template v-slot:content>
{{content}}
</template>
<i :style="{'font-size': size + 'px'}" class="el-icon-info"></i>
</el-tooltip>
</template>
<script>
export default {
name: "MsInstructionsIcon",
props: {
content: String,
icon: {
type: String,
default: 'el-icon-question'
},
placement: {
type: String,
default: 'top-start'
},
type: {
type: String,
default: null
},
effect: {
type: String,
default: 'dark'
},
size: {
type: String,
default: '16'
},
isTesterPermission: {
type: Boolean,
default: false
}
},
}
</script>
<style scoped>
.el-icon-info {
color: #606266;
}
.el-icon-info:hover {
color: #409EFF;
}
</style>

@ -1 +1 @@
Subproject commit 7e4d80cc2b870a8cac6dbb9fe6711ab6041faf6d
Subproject commit 06fc0a321a9886419be5c607ddaa6b40efb5179b

View File

@ -108,6 +108,7 @@ export default {
formatErr: 'Format Error',
id: 'ID',
please_upload: 'Please upload file',
reference_documentation: "Reference documentation",
date: {
select_date: 'Select date',
start_date: 'Start date',
@ -459,6 +460,17 @@ export default {
json_path_expression: "JSONPath expression",
xpath_expression: "XPath expression",
},
processor: {
pre_exec_script : "PreProcessor",
post_exec_script: "PostProcessor",
code_template: "Code template",
bean_shell_processor_tip: "Currently only BeanShell scripts are supported",
code_template_get_variable: "Get variable",
code_template_set_variable: "Set variable",
code_template_get_response_header: "Get response header",
code_template_get_response_code: "Get response code",
code_template_get_response_result: "Get response result"
},
dubbo: {
protocol: "protocol",
input_interface: "Please enter the interface",
@ -816,5 +828,7 @@ export default {
modify: "Modify Quota",
edit_quota_title: "{0} quota",
workspace_quota_list: "Workspace quota list of {0}",
unlimited: "Unlimited",
clean: "Clean"
}
};

View File

@ -107,6 +107,7 @@ export default {
please_upload: '请上传文件',
formatErr: '格式错误',
please_save: '请先保存',
reference_documentation: "参考文档",
id: 'ID',
date: {
select_date: '选择日期',
@ -460,6 +461,17 @@ export default {
json_path_expression: "JSONPath表达式",
xpath_expression: "XPath表达式",
},
processor: {
pre_exec_script : "预执行脚本",
post_exec_script: "后执行脚本",
code_template: "代码模版",
bean_shell_processor_tip: "仅支持 BeanShell 脚本",
code_template_get_variable: "获取变量",
code_template_set_variable: "设置变量",
code_template_get_response_header: "获取响应头",
code_template_get_response_code: "获取响应码",
code_template_get_response_result: "获取响应结果"
},
dubbo: {
protocol: "协议",
input_interface: "请输入Interface",
@ -818,5 +830,7 @@ export default {
modify: "修改配额",
edit_quota_title: "{0}的配额",
workspace_quota_list: "{0}的工作空间配额列表",
unlimited: "无限制",
clean: "清空"
}
};

View File

@ -105,6 +105,7 @@ export default {
formatErr: '格式錯誤',
please_save: '請先保存',
id: 'ID',
reference_documentation: "參考文檔",
please_upload: '請上傳文件',
date: {
select_date: '選擇日期',
@ -459,6 +460,17 @@ export default {
json_path_expression: "JSONPath運算式",
xpath_expression: "XPath運算式",
},
processor: {
pre_exec_script : "預執行腳本",
post_exec_script: "後執行腳本",
code_template: "代碼模版",
bean_shell_processor_tip: "僅支持 BeanShell 腳本",
code_template_get_variable: "獲取變量",
code_template_set_variable: "設置變量",
code_template_get_response_header: "獲取響應頭",
code_template_get_response_code: "獲取響應碼",
code_template_get_response_result: "獲取響應結果"
},
dubbo: {
protocol: "協定",
input_interface: "請輸入Interface",
@ -815,5 +827,7 @@ export default {
modify: "修改配額",
edit_quota_title: "{0}的配額",
workspace_quota_list: "{0}的工作空間配額列表",
unlimited: "無限制",
clean: "清空"
}
};