Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
cccb100e
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cccb100e
编写于
10月 14, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(接口测试): sql 添加自定义变量
上级
0c3b1544
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
1 deletion
+22
-1
backend/src/main/java/io/metersphere/api/dto/scenario/request/SqlRequest.java
...a/io/metersphere/api/dto/scenario/request/SqlRequest.java
+5
-0
frontend/src/business/components/api/test/components/request/ApiSqlRequestForm.vue
...ponents/api/test/components/request/ApiSqlRequestForm.vue
+7
-1
frontend/src/business/components/api/test/model/ScenarioModel.js
...d/src/business/components/api/test/model/ScenarioModel.js
+10
-0
未找到文件。
backend/src/main/java/io/metersphere/api/dto/scenario/request/SqlRequest.java
浏览文件 @
cccb100e
...
...
@@ -2,9 +2,12 @@ package io.metersphere.api.dto.scenario.request;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
io.metersphere.api.dto.scenario.KeyValue
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.List
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@JSONType
(
typeName
=
RequestType
.
SQL
)
...
...
@@ -25,4 +28,6 @@ public class SqlRequest extends Request {
private
String
resultVariable
;
@JSONField
(
ordinal
=
14
)
private
String
variableNames
;
@JSONField
(
ordinal
=
15
)
private
List
<
KeyValue
>
variables
;
}
frontend/src/business/components/api/test/components/request/ApiSqlRequestForm.vue
浏览文件 @
cccb100e
...
...
@@ -41,6 +41,10 @@
<el-button
:disabled=
"!request.enable || !scenario.enable || isReadOnly"
class=
"debug-button"
size=
"small"
type=
"primary"
@
click=
"runDebug"
>
{{
$t
(
'
api_test.request.debug
'
)
}}
</el-button>
<el-tabs
v-model=
"activeName"
>
<el-tab-pane
:label=
"$t('api_test.scenario.variables')"
name=
"variables"
>
<ms-api-scenario-variables
:is-read-only=
"isReadOnly"
:items=
"request.variables"
:description=
"$t('api_test.scenario.kv_description')"
/>
</el-tab-pane>
<el-tab-pane
:label=
"$t('api_test.request.sql.sql_script')"
name=
"sql"
>
<div
class=
"sql-content"
>
<ms-code-edit
mode=
"sql"
:read-only=
"isReadOnly"
:modes=
"['sql']"
:data.sync=
"request.query"
theme=
"eclipse"
ref=
"codeEdit"
/>
...
...
@@ -74,10 +78,12 @@
import
MsDubboConsumerService
from
"
@/business/components/api/test/components/request/dubbo/ConsumerAndService
"
;
import
MsJsr233Processor
from
"
../processor/Jsr233Processor
"
;
import
MsCodeEdit
from
"
../../../../common/components/MsCodeEdit
"
;
import
MsApiScenarioVariables
from
"
../ApiScenarioVariables
"
;
export
default
{
name
:
"
MsApiSqlRequestForm
"
,
components
:
{
MsApiScenarioVariables
,
MsCodeEdit
,
MsJsr233Processor
,
MsDubboConsumerService
,
...
...
@@ -96,7 +102,7 @@
data
()
{
return
{
activeName
:
"
sql
"
,
activeName
:
"
variables
"
,
databaseConfigsOptions
:
[],
rules
:
{
name
:
[
...
...
frontend/src/business/components/api/test/model/ScenarioModel.js
浏览文件 @
cccb100e
...
...
@@ -477,6 +477,7 @@ export class SqlRequest extends Request {
this
.
useEnvironment
=
options
.
useEnvironment
;
this
.
resultVariable
=
options
.
resultVariable
;
this
.
variableNames
=
options
.
variableNames
;
this
.
variables
=
options
.
variables
||
[];
this
.
debugReport
=
undefined
;
this
.
dataSource
=
options
.
dataSource
;
this
.
query
=
options
.
query
;
...
...
@@ -1127,6 +1128,7 @@ class JMXGenerator {
}
else
if
(
request
instanceof
SqlRequest
)
{
request
.
dataSource
=
scenario
.
databaseConfigMap
.
get
(
request
.
dataSource
);
sampler
=
new
JDBCSampler
(
request
.
name
||
""
,
request
);
this
.
addRequestVariables
(
sampler
,
request
);
}
else
if
(
request
instanceof
TCPRequest
)
{
sampler
=
new
TCPSampler
(
request
.
name
||
""
,
new
JMXTCPRequest
(
request
,
scenario
));
}
...
...
@@ -1188,6 +1190,14 @@ class JMXGenerator {
}
}
addRequestVariables
(
httpSamplerProxy
,
request
)
{
let
name
=
request
.
name
+
"
Variables
"
;
let
variables
=
this
.
filterKV
(
request
.
variables
);
if
(
variables
&&
variables
.
length
>
0
)
{
httpSamplerProxy
.
put
(
new
Arguments
(
name
,
variables
));
}
}
addScenarioCookieManager
(
threadGroup
,
scenario
)
{
if
(
scenario
.
enableCookieShare
)
{
threadGroup
.
put
(
new
CookieManager
(
scenario
.
name
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录