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
9876fc2b
Commit
9876fc2b
authored
3 years ago
by
guoyuqi
Committed by
jianxing
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix(测试跟踪): 修复功能用例导入Excel步骤有问题
--user=郭雨琦 修复功能用例导入Excel步骤有问题
parent
b167f975
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java
+8
-16
...tersphere/excel/listener/TestCaseNoModelDataListener.java
with
8 additions
and
16 deletions
+8
-16
backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java
+
8
-
16
View file @
9876fc2b
...
...
@@ -521,11 +521,11 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
Set
<
Integer
>
rowNums
=
new
HashSet
<>();
if
(
data
.
getStepDesc
()
!=
null
)
{
String
[]
stepDesc
=
data
.
getStepDesc
().
split
(
"\r\n"
);
String
[]
stepDesc
=
data
.
getStepDesc
().
split
(
"\r
|\n|\r
\n"
);
int
rowIndex
=
1
;
for
(
String
row
:
stepDesc
)
{
TestCaseNoModelDataListener
.
RowInfo
rowInfo
=
this
.
parseIndexInRow
(
row
);
TestCaseNoModelDataListener
.
RowInfo
rowInfo
=
this
.
parseIndexInRow
(
row
,
rowIndex
);
stepDescList
.
add
(
rowInfo
.
rowInfo
);
rowNums
.
add
(
rowIndex
++);
}
...
...
@@ -534,21 +534,13 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
}
if
(
data
.
getStepResult
()
!=
null
)
{
String
stepResult
=
data
.
getStepResult
().
replaceAll
(
"\\n([0-9]+\\.)"
,
"\r\n$1"
);
String
[]
stepRes
=
stepResult
.
split
(
"\r\n"
);
String
[]
stepRes
=
data
.
getStepResult
().
split
(
"\r|\n|\r\n"
);
int
lastStepIndex
=
1
;
for
(
String
row
:
stepRes
)
{
TestCaseNoModelDataListener
.
RowInfo
rowInfo
=
this
.
parseIndexInRow
(
row
);
int
rowIndex
=
rowInfo
.
index
;
TestCaseNoModelDataListener
.
RowInfo
rowInfo
=
this
.
parseIndexInRow
(
row
,
lastStepIndex
);
String
rowMessage
=
rowInfo
.
rowInfo
;
if
(
rowIndex
>
-
1
&&
rowNums
.
contains
(
rowIndex
))
{
listUtils
.
set
(
stepResList
,
lastStepIndex
-
1
,
rowMessage
,
""
);
lastStepIndex
=
rowIndex
;
}
else
{
listUtils
.
set
(
stepResList
,
lastStepIndex
-
1
,
rowMessage
,
""
);
lastStepIndex
++;
}
stepResList
.
add
(
rowMessage
);
lastStepIndex
++;
}
}
else
{
stepResList
.
add
(
""
);
...
...
@@ -578,7 +570,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
return
jsonArray
.
toJSONString
();
}
private
RowInfo
parseIndexInRow
(
String
row
)
{
private
RowInfo
parseIndexInRow
(
String
row
,
int
rowIndex
)
{
RowInfo
rowInfo
=
new
RowInfo
();
String
parseString
=
row
;
int
index
=
-
1
;
...
...
@@ -592,7 +584,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
String
[]
rowSplit
=
StringUtils
.
split
(
parseString
,
splitChar
);
if
(
rowSplit
.
length
>
0
)
{
String
indexString
=
rowSplit
[
0
];
if
(
StringUtils
.
isNumeric
(
indexString
))
{
if
(
StringUtils
.
isNumeric
(
indexString
)
&&
indexString
.
equals
(
String
.
valueOf
(
rowIndex
))
)
{
try
{
index
=
Integer
.
parseInt
(
indexString
);
rowMessage
=
StringUtils
.
substring
(
parseString
,
indexString
.
length
()
+
splitChar
.
length
());
...
...
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