Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
8deca826
Commit
8deca826
authored
3 years ago
by
fit2-zhao
Committed by
song-tianyang
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix(接口测试): 修复场景报告步骤统计计算错误问题
parent
d5cf72dc
v1.16
pr@v1.16@fix_scenario_load
pr@v1.16@fix_接口测试_安全漏洞
pr@v1.16@fix_接口测试_引用问题
pr@v1.16@refactor_获取场景报告接口效率优化
repr@dev_v1.16@a009bb38@fix_接口测试_场景执行
repr@dev_v1.16_v1.17@430a1864ffe9800240f4fbd9b0c92991305c0baa@fix_脑图创建的用例导出状态和责任人为空
repr@dev_v1.16_v1.17@91c1b2a7@fix_接口测试_插件步骤
repr@v1.16_dev@09a4129d@fix_接口测试_调试状态
repr@v1.16_dev@e2e90011@fix_testplan_用例执行
repr@v1.16_v1.17_dev@bfb01376@fix_bugs_import_api
repr@v1.16_v1.17_dev@dd1880fa@fix_bugs_0118
v1.16.6
v1.16.5
v1.16.4
v1.16.3
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java
+27
-6
...sphere/api/service/ApiScenarioReportStructureService.java
with
27 additions
and
6 deletions
+27
-6
backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java
+
27
-
6
View file @
8deca826
...
...
@@ -121,6 +121,31 @@ public class ApiScenarioReportStructureService {
}
}
private
void
stepErrorCalculate
(
List
<
StepTreeDTO
>
dtoList
,
AtomicLong
isError
)
{
for
(
StepTreeDTO
step
:
dtoList
)
{
if
(
step
.
getValue
()
!=
null
&&
step
.
getValue
().
getError
()
>
0
)
{
isError
.
set
(
isError
.
longValue
()
+
1
);
}
else
if
(
CollectionUtils
.
isNotEmpty
(
step
.
getChildren
()))
{
AtomicLong
isChildrenError
=
new
AtomicLong
();
stepChildrenErrorCalculate
(
step
.
getChildren
(),
isChildrenError
);
if
(
isChildrenError
.
longValue
()
>
0
)
{
isError
.
set
(
isError
.
longValue
()
+
1
);
}
}
}
}
private
void
stepChildrenErrorCalculate
(
List
<
StepTreeDTO
>
dtoList
,
AtomicLong
isError
)
{
for
(
StepTreeDTO
step
:
dtoList
)
{
if
(
step
.
getValue
()
!=
null
&&
step
.
getValue
().
getError
()
>
0
)
{
isError
.
set
(
isError
.
longValue
()
+
1
);
break
;
}
else
if
(
CollectionUtils
.
isNotEmpty
(
step
.
getChildren
()))
{
stepChildrenErrorCalculate
(
step
.
getChildren
(),
isError
);
}
}
}
private
void
calculate
(
List
<
StepTreeDTO
>
dtoList
,
AtomicLong
totalScenario
,
AtomicLong
scenarioError
,
AtomicLong
totalTime
)
{
for
(
StepTreeDTO
step
:
dtoList
)
{
if
(
StringUtils
.
equals
(
step
.
getType
(),
"scenario"
))
{
...
...
@@ -147,11 +172,7 @@ public class ApiScenarioReportStructureService {
private
void
calculateStep
(
List
<
StepTreeDTO
>
dtoList
,
AtomicLong
stepError
,
AtomicLong
stepTotal
)
{
for
(
StepTreeDTO
step
:
dtoList
)
{
// 失败结果数量
AtomicLong
error
=
new
AtomicLong
();
scenarioCalculate
(
step
.
getChildren
(),
error
);
if
(
error
.
longValue
()
>
0
)
{
stepError
.
set
((
stepError
.
longValue
()
+
1
));
}
stepErrorCalculate
(
step
.
getChildren
(),
stepError
);
if
(
CollectionUtils
.
isNotEmpty
(
step
.
getChildren
()))
{
stepTotal
.
set
((
stepTotal
.
longValue
()
+
step
.
getChildren
().
size
()));
}
...
...
@@ -235,7 +256,7 @@ public class ApiScenarioReportStructureService {
calculateStep
(
stepList
,
stepError
,
stepTotal
);
reportDTO
.
setScenarioStepTotal
(
stepTotal
.
longValue
());
reportDTO
.
setScenarioStepError
(
stepError
.
longValue
());
reportDTO
.
setScenarioStepSuccess
((
step
List
.
siz
e
()
-
stepError
.
longValue
()));
reportDTO
.
setScenarioStepSuccess
((
step
Total
.
longValu
e
()
-
stepError
.
longValue
()));
reportDTO
.
setConsole
(
scenarioReportStructure
.
getConsole
());
reportDTO
.
setSteps
(
stepList
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help