Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
fcb8eeed
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,发现更多精彩内容 >>
提交
fcb8eeed
编写于
8月 18, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(接口测试): 支持Beanshell脚本
上级
163fae2e
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
88 addition
and
10 deletion
+88
-10
backend/pom.xml
backend/pom.xml
+0
-5
backend/src/main/java/io/metersphere/api/dto/scenario/processor/BeanShellPostProcessor.java
...re/api/dto/scenario/processor/BeanShellPostProcessor.java
+10
-0
backend/src/main/java/io/metersphere/api/dto/scenario/processor/BeanShellPreProcessor.java
...ere/api/dto/scenario/processor/BeanShellPreProcessor.java
+10
-0
backend/src/main/java/io/metersphere/api/dto/scenario/processor/BeanShellProcessor.java
...sphere/api/dto/scenario/processor/BeanShellProcessor.java
+8
-0
backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java
.../io/metersphere/api/dto/scenario/request/HttpRequest.java
+6
-0
backend/src/main/java/io/metersphere/xpack
backend/src/main/java/io/metersphere/xpack
+1
-1
frontend/src/business/components/api/test/components/processor/BeanShellProcessor.vue
...ents/api/test/components/processor/BeanShellProcessor.vue
+0
-3
frontend/src/business/components/api/test/model/JMX.js
frontend/src/business/components/api/test/model/JMX.js
+28
-0
frontend/src/business/components/api/test/model/ScenarioModel.js
...d/src/business/components/api/test/model/ScenarioModel.js
+25
-1
未找到文件。
backend/pom.xml
浏览文件 @
fcb8eeed
...
@@ -140,11 +140,6 @@
...
@@ -140,11 +140,6 @@
</dependency>
</dependency>
<!-- jmeter -->
<!-- jmeter -->
<!-- <dependency>-->
<!-- <groupId>org.apache.jmeter</groupId>-->
<!-- <artifactId>ApacheJMeter_core</artifactId>-->
<!-- <version>${jmeter.version}</version>-->
<!-- </dependency>-->
<dependency>
<dependency>
<groupId>
org.apache.jmeter
</groupId>
<groupId>
org.apache.jmeter
</groupId>
...
...
backend/src/main/java/io/metersphere/api/dto/scenario/processor/BeanShellPostProcessor.java
0 → 100644
浏览文件 @
fcb8eeed
package
io.metersphere.api.dto.scenario.processor
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
BeanShellPostProcessor
extends
BeanShellProcessor
{
}
backend/src/main/java/io/metersphere/api/dto/scenario/processor/BeanShellPreProcessor.java
0 → 100644
浏览文件 @
fcb8eeed
package
io.metersphere.api.dto.scenario.processor
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
BeanShellPreProcessor
extends
BeanShellProcessor
{
}
backend/src/main/java/io/metersphere/api/dto/scenario/processor/BeanShellProcessor.java
0 → 100644
浏览文件 @
fcb8eeed
package
io.metersphere.api.dto.scenario.processor
;
import
lombok.Data
;
@Data
public
class
BeanShellProcessor
{
private
String
script
;
}
backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java
浏览文件 @
fcb8eeed
...
@@ -6,6 +6,8 @@ import io.metersphere.api.dto.scenario.Body;
...
@@ -6,6 +6,8 @@ import io.metersphere.api.dto.scenario.Body;
import
io.metersphere.api.dto.scenario.KeyValue
;
import
io.metersphere.api.dto.scenario.KeyValue
;
import
io.metersphere.api.dto.scenario.assertions.Assertions
;
import
io.metersphere.api.dto.scenario.assertions.Assertions
;
import
io.metersphere.api.dto.scenario.extract.Extract
;
import
io.metersphere.api.dto.scenario.extract.Extract
;
import
io.metersphere.api.dto.scenario.processor.BeanShellPostProcessor
;
import
io.metersphere.api.dto.scenario.processor.BeanShellPreProcessor
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
...
@@ -35,4 +37,8 @@ public class HttpRequest implements Request {
...
@@ -35,4 +37,8 @@ public class HttpRequest implements Request {
private
Assertions
assertions
;
private
Assertions
assertions
;
@JSONField
(
ordinal
=
10
)
@JSONField
(
ordinal
=
10
)
private
Extract
extract
;
private
Extract
extract
;
@JSONField
(
ordinal
=
11
)
private
BeanShellPreProcessor
beanShellPreProcessor
;
@JSONField
(
ordinal
=
12
)
private
BeanShellPostProcessor
beanShellPostProcessor
;
}
}
xpack
@
b86032cb
比较
8de0d4e4
...
b86032cb
Subproject commit
8de0d4e47675bd1a5a8ea4c99e1a2b76e53ebc08
Subproject commit
b86032cbbda9a9e6028308aa95a887cff2192f1c
frontend/src/business/components/api/test/components/processor/BeanShellProcessor.vue
浏览文件 @
fcb8eeed
...
@@ -23,9 +23,6 @@
...
@@ -23,9 +23,6 @@
},
},
beanShellProcessor
:
{
beanShellProcessor
:
{
type
:
Object
,
type
:
Object
,
default
()
{
return
{}
}
}
}
},
},
}
}
...
...
frontend/src/business/components/api/test/model/JMX.js
浏览文件 @
fcb8eeed
...
@@ -405,12 +405,40 @@ export class ResponseHeadersAssertion extends ResponseAssertion {
...
@@ -405,12 +405,40 @@ export class ResponseHeadersAssertion extends ResponseAssertion {
}
}
}
}
export
class
BeanShellProcessor
extends
DefaultTestElement
{
constructor
(
tag
,
guiclass
,
testclass
,
testname
,
processor
)
{
super
(
tag
,
guiclass
,
testclass
,
testname
);
this
.
processor
=
processor
||
{};
this
.
boolProp
(
'
resetInterpreter
'
,
false
);
this
.
stringProp
(
'
parameters
'
);
this
.
stringProp
(
'
filename
'
);
this
.
stringProp
(
'
script
'
,
processor
.
script
);
}
}
export
class
BeanShellPreProcessor
extends
BeanShellProcessor
{
constructor
(
testName
,
processor
)
{
super
(
'
BeanShellPreProcessor
'
,
'
TestBeanGUI
'
,
'
BeanShellPreProcessor
'
,
testName
,
processor
)
}
}
export
class
BeanShellPostProcessor
extends
BeanShellProcessor
{
constructor
(
testName
,
script
)
{
let
processor
=
{
script
:
script
,
};
super
(
'
BeanShellPostProcessor
'
,
'
TestBeanGUI
'
,
'
BeanShellPostProcessor
'
,
testName
,
processor
)
}
}
export
class
HeaderManager
extends
DefaultTestElement
{
export
class
HeaderManager
extends
DefaultTestElement
{
constructor
(
testName
,
headers
)
{
constructor
(
testName
,
headers
)
{
super
(
'
HeaderManager
'
,
'
HeaderPanel
'
,
'
HeaderManager
'
,
testName
);
super
(
'
HeaderManager
'
,
'
HeaderPanel
'
,
'
HeaderManager
'
,
testName
);
this
.
headers
=
headers
||
[];
this
.
headers
=
headers
||
[];
let
collectionProp
=
this
.
collectionProp
(
'
HeaderManager.headers
'
);
let
collectionProp
=
this
.
collectionProp
(
'
HeaderManager.headers
'
);
this
.
headers
.
forEach
(
header
=>
{
this
.
headers
.
forEach
(
header
=>
{
let
elementProp
=
collectionProp
.
elementProp
(
''
,
'
Header
'
);
let
elementProp
=
collectionProp
.
elementProp
(
''
,
'
Header
'
);
elementProp
.
stringProp
(
'
Header.name
'
,
header
.
name
);
elementProp
.
stringProp
(
'
Header.name
'
,
header
.
name
);
...
...
frontend/src/business/components/api/test/model/ScenarioModel.js
浏览文件 @
fcb8eeed
import
{
import
{
Arguments
,
Arguments
,
BeanShellPreProcessor
,
CookieManager
,
CookieManager
,
DubboSample
,
DubboSample
,
DurationAssertion
,
DurationAssertion
,
...
@@ -302,6 +302,8 @@ export class HttpRequest extends Request {
...
@@ -302,6 +302,8 @@ export class HttpRequest extends Request {
this
.
environment
=
undefined
;
this
.
environment
=
undefined
;
this
.
useEnvironment
=
undefined
;
this
.
useEnvironment
=
undefined
;
this
.
debugReport
=
undefined
;
this
.
debugReport
=
undefined
;
this
.
beanShellPreProcessor
=
undefined
;
this
.
beanShellPostProcessor
=
undefined
;
this
.
set
(
options
);
this
.
set
(
options
);
this
.
sets
({
parameters
:
KeyValue
,
headers
:
KeyValue
},
options
);
this
.
sets
({
parameters
:
KeyValue
,
headers
:
KeyValue
},
options
);
...
@@ -313,6 +315,8 @@ export class HttpRequest extends Request {
...
@@ -313,6 +315,8 @@ export class HttpRequest extends Request {
options
.
body
=
new
Body
(
options
.
body
);
options
.
body
=
new
Body
(
options
.
body
);
options
.
assertions
=
new
Assertions
(
options
.
assertions
);
options
.
assertions
=
new
Assertions
(
options
.
assertions
);
options
.
extract
=
new
Extract
(
options
.
extract
);
options
.
extract
=
new
Extract
(
options
.
extract
);
options
.
beanShellPreProcessor
=
new
BeanShellProcessor
(
options
.
beanShellPreProcessor
);
options
.
beanShellPostProcessor
=
new
BeanShellProcessor
(
options
.
beanShellPostProcessor
);
return
options
;
return
options
;
}
}
...
@@ -352,6 +356,7 @@ export class HttpRequest extends Request {
...
@@ -352,6 +356,7 @@ export class HttpRequest extends Request {
showMethod
()
{
showMethod
()
{
return
this
.
method
.
toUpperCase
();
return
this
.
method
.
toUpperCase
();
}
}
}
}
export
class
DubboRequest
extends
Request
{
export
class
DubboRequest
extends
Request
{
...
@@ -564,6 +569,14 @@ export class AssertionType extends BaseConfig {
...
@@ -564,6 +569,14 @@ export class AssertionType extends BaseConfig {
}
}
}
}
export
class
BeanShellProcessor
extends
BaseConfig
{
constructor
(
options
)
{
super
();
this
.
script
=
undefined
;
this
.
set
(
options
);
}
}
export
class
Text
extends
AssertionType
{
export
class
Text
extends
AssertionType
{
constructor
(
options
)
{
constructor
(
options
)
{
super
(
ASSERTION_TYPE
.
TEXT
);
super
(
ASSERTION_TYPE
.
TEXT
);
...
@@ -818,6 +831,7 @@ class JMXGenerator {
...
@@ -818,6 +831,7 @@ class JMXGenerator {
}
else
{
}
else
{
this
.
addRequestBody
(
sampler
,
request
);
this
.
addRequestBody
(
sampler
,
request
);
}
}
this
.
addBeanShellProcessor
(
sampler
,
request
);
}
}
this
.
addRequestAssertion
(
sampler
,
request
);
this
.
addRequestAssertion
(
sampler
,
request
);
...
@@ -886,6 +900,16 @@ class JMXGenerator {
...
@@ -886,6 +900,16 @@ class JMXGenerator {
}
}
}
}
addBeanShellProcessor
(
httpSamplerProxy
,
request
)
{
let
name
=
request
.
name
;
if
(
request
.
beanShellPreProcessor
&&
request
.
beanShellPreProcessor
.
script
)
{
httpSamplerProxy
.
put
(
new
BeanShellPreProcessor
(
name
,
request
.
beanShellPreProcessor
));
}
if
(
request
.
beanShellPostProcessor
&&
request
.
beanShellPostProcessor
.
script
)
{
httpSamplerProxy
.
put
(
new
BeanShellPreProcessor
(
name
,
request
.
beanShellPostProcessor
));
}
}
addBodyFormat
(
request
)
{
addBodyFormat
(
request
)
{
let
bodyFormat
=
request
.
body
.
format
;
let
bodyFormat
=
request
.
body
.
format
;
if
(
bodyFormat
)
{
if
(
bodyFormat
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录