feat(接口测试): Jmeter 函数说明

This commit is contained in:
Captain.B 2020-08-14 16:50:12 +08:00
parent 2eaa93b95c
commit ea872b5f79
5 changed files with 49 additions and 46 deletions

View File

@ -33,7 +33,7 @@
</el-col> </el-col>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="变量"> <el-tab-pane :label="$t('api_test.variable')">
<el-row> <el-row>
<el-col :span="6" class="col-height"> <el-col :span="6" class="col-height">
<div v-if="environment"> <div v-if="environment">
@ -49,15 +49,14 @@
<el-tree :data="preRequestParams" :props="treeProps" @node-click="selectVariable"></el-tree> <el-tree :data="preRequestParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div> </div>
</el-col> </el-col>
<el-col :span="6" v-for="(itemFunc, itemIndex) in jmeterVariableFuncs" :key="itemIndex" class="col-height"> <el-col :span="18" class="col-height">
<div> <div>
<div v-for="(func, funcIndex) in jmeterFuncs" <h1>Jmeter 内置函数</h1>
:key="`${itemIndex}-${funcIndex}`"> <el-table border :data="jmeterFuncs" class="adjust-table table-content" height="400">
<el-row> <el-table-column prop="type" label="Type" width="150"/>
<el-radio size="mini" v-model="itemFunc.name" :label="func.name" <el-table-column prop="name" label="Functions" width="250"/>
@change="methodChange(itemFunc, func)"/> <el-table-column prop="description" label="Description"/>
</el-row> </el-table>
</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -113,39 +113,39 @@ export const MOCKJS_FUNC = [
] ]
export const JMETER_FUNC = [ export const JMETER_FUNC = [
{name: "${__threadNum}"}, {type: "Information", name: "${__threadNum}", description: "get thread number"},
{name: "${__samplerName}"}, {type: "Information", name: "${__samplerName}", description: "get the sampler name (label)"},
{name: "${__machineIP}"}, {type: "Information", name: "${__machineIP}", description: "get the local machine IP address"},
{name: "${__machineName}"}, {type: "Information", name: "${__machineName}", description: "get the local machine name"},
{name: "${__time}"}, {type: "Information", name: "${__time}", description: "return current time in various formats"},
{name: "${__log}"}, {type: "Information", name: "${__log}", description: "log (or display) a message (and return the value)"},
{name: "${__logn}"}, {type: "Information", name: "${__logn}", description: "log (or display) a message (empty return value)"},
{name: "${__StringFromFile}"}, {type: "Input", name: "${__StringFromFile}", description: "read a line from a file"},
{name: "${__FileToString}"}, {type: "Input", name: "${__FileToString}", description: "read an entire file"},
{name: "${__CSVRead}"}, {type: "Input", name: "${__CSVRead}", description: "read from CSV delimited file"},
{name: "${__XPath}"}, {type: "Input", name: "${__XPath}", description: "Use an XPath expression to read from a file"},
{name: "${__counter}"}, {type: "Calculation", name: "${__counter}", description: "generate an incrementing number"},
{name: "${__intSum}"}, {type: "Calculation", name: "${__intSum}", description: "add int numbers"},
{name: "${__longSum}"}, {type: "Calculation", name: "${__longSum}", description: "add long numbers"},
{name: "${__Random}"}, {type: "Calculation", name: "${__Random}", description: "generate a random number"},
{name: "${__RandomString}"}, {type: "Calculation", name: "${__RandomString}", description: "generate a random string"},
{name: "${__UUID}"}, {type: "Calculation", name: "${__UUID}", description: "generate a random type 4 UUID"},
{name: "${__BeanShell}"}, {type: "Scripting", name: "${__BeanShell}", description: "run a BeanShell script"},
{name: "${__javaScript}"}, {type: "Scripting", name: "${__javaScript}", description: "process JavaScript (Mozilla Rhino)"},
{name: "${__jexl}"}, {type: "Scripting", name: "${__jexl}", description: "evaluate a Commons Jexl expression"},
{name: "${__jexl2}"}, {type: "Scripting", name: "${__jexl2}", description: "evaluate a Commons Jexl expression"},
{name: "${__property}"}, {type: "Properties", name: "${__property}", description: "read a property"},
{name: "${__P}"}, {type: "Properties", name: "${__P}", description: "read a property (shorthand method)"},
{name: "${__setProperty}"}, {type: "Properties", name: "${__setProperty}", description: "set a JMeter property"},
{name: "${__split}"}, {type: "Variables", name: "${__split}", description: "Split a string into variables"},
{name: "${__V}"}, {type: "Variables", name: "${__V}", description: "evaluate a variable name"},
{name: "${__eval}"}, {type: "Variables", name: "${__eval}", description: "evaluate a variable expression"},
{name: "${__evalVar}"}, {type: "Variables", name: "${__evalVar}", description: "evaluate an expression stored in a variable"},
{name: "${__regexFunction}"}, {type: "String", name: "${__regexFunction}", description: "parse previous response using a regular expression"},
{name: "${__escapeOroRegexpChars}"}, {type: "String", name: "${__escapeOroRegexpChars}", description: "quote meta chars used by ORO regular expression"},
{name: "${__char}"}, {type: "String", name: "${__char}", description: "generate Unicode char values from a list of numbers"},
{name: "${__unescape}"}, {type: "String", name: "${__unescape}", description: "Process strings containing Java escapes (e.g. & )"},
{name: "${__unescapeHtml}"}, {type: "String", name: "${__unescapeHtml}", description: "Decode HTML-encoded strings"},
{name: "${__escapeHtml}"}, {type: "String", name: "${__escapeHtml}", description: "Encode strings using HTML encoding"},
{name: "${__TestPlanName}"}, {type: "String", name: "${__TestPlanName}", description: "Return name of current test plan"},
] ]

View File

@ -353,6 +353,7 @@ export default {
input_name: "Please enter the test name", input_name: "Please enter the test name",
select_project: "Please select project", select_project: "Please select project",
variable_name: "Variable name", variable_name: "Variable name",
variable: "Variable",
copied: "copied", copied: "copied",
key: "Key", key: "Key",
value: "Value", value: "Value",
@ -401,6 +402,7 @@ export default {
url_description: "etc: https://fit2cloud.com", url_description: "etc: https://fit2cloud.com",
path_description: "etc/login", path_description: "etc/login",
parameters: "Query parameters", parameters: "Query parameters",
jmeter_func: "Jmeter Functions",
parameters_filter_example: "Example", parameters_filter_example: "Example",
parameters_filter_tips: "Only support MockJs function result preview", parameters_filter_tips: "Only support MockJs function result preview",
parameters_advance: "Advanced parameter settings", parameters_advance: "Advanced parameter settings",

View File

@ -354,6 +354,7 @@ export default {
input_name: "请输入测试名称", input_name: "请输入测试名称",
select_project: "请选择项目", select_project: "请选择项目",
variable_name: "变量名", variable_name: "变量名",
variable: "变量",
copied: "已拷贝", copied: "已拷贝",
key: "键", key: "键",
value: "值", value: "值",
@ -402,8 +403,7 @@ export default {
path_description: "例如:/login", path_description: "例如:/login",
url_invalid: "URL无效", url_invalid: "URL无效",
parameters: "请求参数", parameters: "请求参数",
parameters_filter: "内置函数", jmeter_func: "Jmeter 方法",
parameters_filter_desc: "使用方法",
parameters_filter_example: "示例", parameters_filter_example: "示例",
parameters_filter_tips: "只支持 MockJs 函数结果预览", parameters_filter_tips: "只支持 MockJs 函数结果预览",
parameters_advance: "高级参数设置", parameters_advance: "高级参数设置",

View File

@ -352,6 +352,7 @@ export default {
input_name: "請輸入測試名稱", input_name: "請輸入測試名稱",
select_project: "請選擇項目", select_project: "請選擇項目",
variable_name: "變數名", variable_name: "變數名",
variable: "變數",
copied: "已拷貝", copied: "已拷貝",
key: "鍵", key: "鍵",
value: "值", value: "值",
@ -401,6 +402,7 @@ export default {
path_description: "例如:/login", path_description: "例如:/login",
url_invalid: "URL無效", url_invalid: "URL無效",
parameters: "請求參數", parameters: "請求參數",
jmeter_func: "Jmeter 方法",
parameters_filter_example: "示例", parameters_filter_example: "示例",
parameters_filter_tips: "只支持MockJs函數結果預覽", parameters_filter_tips: "只支持MockJs函數結果預覽",
parameters_advance: "高級參數設置", parameters_advance: "高級參數設置",