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

View File

@ -113,39 +113,39 @@ export const MOCKJS_FUNC = [
]
export const JMETER_FUNC = [
{name: "${__threadNum}"},
{name: "${__samplerName}"},
{name: "${__machineIP}"},
{name: "${__machineName}"},
{name: "${__time}"},
{name: "${__log}"},
{name: "${__logn}"},
{name: "${__StringFromFile}"},
{name: "${__FileToString}"},
{name: "${__CSVRead}"},
{name: "${__XPath}"},
{name: "${__counter}"},
{name: "${__intSum}"},
{name: "${__longSum}"},
{name: "${__Random}"},
{name: "${__RandomString}"},
{name: "${__UUID}"},
{name: "${__BeanShell}"},
{name: "${__javaScript}"},
{name: "${__jexl}"},
{name: "${__jexl2}"},
{name: "${__property}"},
{name: "${__P}"},
{name: "${__setProperty}"},
{name: "${__split}"},
{name: "${__V}"},
{name: "${__eval}"},
{name: "${__evalVar}"},
{name: "${__regexFunction}"},
{name: "${__escapeOroRegexpChars}"},
{name: "${__char}"},
{name: "${__unescape}"},
{name: "${__unescapeHtml}"},
{name: "${__escapeHtml}"},
{name: "${__TestPlanName}"},
{type: "Information", name: "${__threadNum}", description: "get thread number"},
{type: "Information", name: "${__samplerName}", description: "get the sampler name (label)"},
{type: "Information", name: "${__machineIP}", description: "get the local machine IP address"},
{type: "Information", name: "${__machineName}", description: "get the local machine name"},
{type: "Information", name: "${__time}", description: "return current time in various formats"},
{type: "Information", name: "${__log}", description: "log (or display) a message (and return the value)"},
{type: "Information", name: "${__logn}", description: "log (or display) a message (empty return value)"},
{type: "Input", name: "${__StringFromFile}", description: "read a line from a file"},
{type: "Input", name: "${__FileToString}", description: "read an entire file"},
{type: "Input", name: "${__CSVRead}", description: "read from CSV delimited file"},
{type: "Input", name: "${__XPath}", description: "Use an XPath expression to read from a file"},
{type: "Calculation", name: "${__counter}", description: "generate an incrementing number"},
{type: "Calculation", name: "${__intSum}", description: "add int numbers"},
{type: "Calculation", name: "${__longSum}", description: "add long numbers"},
{type: "Calculation", name: "${__Random}", description: "generate a random number"},
{type: "Calculation", name: "${__RandomString}", description: "generate a random string"},
{type: "Calculation", name: "${__UUID}", description: "generate a random type 4 UUID"},
{type: "Scripting", name: "${__BeanShell}", description: "run a BeanShell script"},
{type: "Scripting", name: "${__javaScript}", description: "process JavaScript (Mozilla Rhino)"},
{type: "Scripting", name: "${__jexl}", description: "evaluate a Commons Jexl expression"},
{type: "Scripting", name: "${__jexl2}", description: "evaluate a Commons Jexl expression"},
{type: "Properties", name: "${__property}", description: "read a property"},
{type: "Properties", name: "${__P}", description: "read a property (shorthand method)"},
{type: "Properties", name: "${__setProperty}", description: "set a JMeter property"},
{type: "Variables", name: "${__split}", description: "Split a string into variables"},
{type: "Variables", name: "${__V}", description: "evaluate a variable name"},
{type: "Variables", name: "${__eval}", description: "evaluate a variable expression"},
{type: "Variables", name: "${__evalVar}", description: "evaluate an expression stored in a variable"},
{type: "String", name: "${__regexFunction}", description: "parse previous response using a regular expression"},
{type: "String", name: "${__escapeOroRegexpChars}", description: "quote meta chars used by ORO regular expression"},
{type: "String", name: "${__char}", description: "generate Unicode char values from a list of numbers"},
{type: "String", name: "${__unescape}", description: "Process strings containing Java escapes (e.g. & )"},
{type: "String", name: "${__unescapeHtml}", description: "Decode HTML-encoded strings"},
{type: "String", name: "${__escapeHtml}", description: "Encode strings using HTML encoding"},
{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",
select_project: "Please select project",
variable_name: "Variable name",
variable: "Variable",
copied: "copied",
key: "Key",
value: "Value",
@ -401,6 +402,7 @@ export default {
url_description: "etc: https://fit2cloud.com",
path_description: "etc/login",
parameters: "Query parameters",
jmeter_func: "Jmeter Functions",
parameters_filter_example: "Example",
parameters_filter_tips: "Only support MockJs function result preview",
parameters_advance: "Advanced parameter settings",

View File

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

View File

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