Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
1a866870
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
11 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1a866870
编写于
3月 23, 2023
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue of exec the case with independent expect results
上级
1eef442e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
11 deletion
+49
-11
demo/t/2.exp
demo/t/2.exp
+7
-0
demo/t/2.php
demo/t/2.php
+28
-0
internal/pkg/helper/script/generator.go
internal/pkg/helper/script/generator.go
+1
-1
internal/pkg/helper/script/parser.go
internal/pkg/helper/script/parser.go
+13
-10
未找到文件。
demo/t/2.exp
0 → 100644
浏览文件 @
1a866870
期待结果1
期待结果2.1
{
期待结果2.2-1
期待结果2.2-2
}
期待结果3
\ No newline at end of file
demo/t/2.php
0 → 100755
浏览文件 @
1a866870
#!/usr/bin/env php
<?php
/**
title=测试用例标题
cid=2
- 步骤1 @
- 步骤2
- 子步骤2.1 @
- 子步骤2.2 @
- 步骤3
- 步骤4 @
*/
print
(
"@期待结果1
\n
"
);
print
(
"@期待结果2.1
\n
"
);
print
(
"@{\n"
);
print
(
"期待结果2.2-1
\n
"
);
print
(
"期待结果2.2-2
\n
"
);
print
(
"}
\n
"
);
print
(
"@期待结果3
\n
"
);
?>
\ No newline at end of file
internal/pkg/helper/script/generator.go
浏览文件 @
1a866870
...
...
@@ -248,7 +248,7 @@ func getExpectContent(str string, isChild bool, independentFile bool) (ret strin
// expect 1.2 line 1
// expect 1.2 line 2
//>>
ret
=
"
@
{
\n
"
+
space
+
strings
.
ReplaceAll
(
str
,
rpl
,
rpl
+
space
)
+
"
\n
}"
ret
=
"{
\n
"
+
space
+
strings
.
ReplaceAll
(
str
,
rpl
,
rpl
+
space
)
+
"
\n
}"
}
else
{
//step 1.2 @{
// expect 1.2 line 1
...
...
internal/pkg/helper/script/parser.go
浏览文件 @
1a866870
...
...
@@ -98,7 +98,10 @@ func getSingleExpect(descAndExpect string) (desc, expect string) {
desc
=
strings
.
TrimSpace
(
arr
[
0
])
if
len
(
arr
)
>
1
{
expect
=
arr
[
1
]
expect
=
strings
.
TrimSpace
(
arr
[
1
])
if
expect
==
""
{
expect
=
"pass"
}
}
return
...
...
@@ -185,7 +188,7 @@ func ReadCaseInfoInOldFormat(content, lang string) (info, checkpoints string) {
func
GetStepAndExpectMapInOldFormat
(
checkpoints
,
file
string
)
(
steps
[]
commDomain
.
ZentaoCaseStep
)
{
lines
:=
strings
.
Split
(
checkpoints
,
"
\n
"
)
groupArr
:=
getStepNestedArr
(
lines
)
groupArr
:=
getStepNestedArr
InOldFormat
(
lines
)
_
,
steps
=
getSortedTextFromNestedSteps
(
groupArr
)
isIndependent
,
expectIndependentContent
:=
GetDependentExpect
(
file
)
...
...
@@ -225,7 +228,7 @@ func GetDependentExpect(file string) (bool, string) {
return
false
,
""
}
func
getStepNestedArr
(
lines
[]
string
)
(
ret
[]
commDomain
.
ZtfStep
)
{
func
getStepNestedArr
InOldFormat
(
lines
[]
string
)
(
ret
[]
commDomain
.
ZtfStep
)
{
parent
:=
commDomain
.
ZtfStep
{}
increase
:=
0
for
index
:=
0
;
index
<
len
(
lines
);
index
++
{
...
...
@@ -487,14 +490,14 @@ func GetCaseInfo(file string) (pass bool, caseId, productId int, title string, t
func
ReadExpectIndependentArr
(
content
string
)
[][]
string
{
//正常显示6
//E2.16
//
>>
//
{
// E2.2 - 16
// E2.2 - 26
//
>>
//
>>
//
}
//
{
// E3 - 16
// E3 - 26
//
>>
//
}
lines
:=
strings
.
Split
(
content
,
"
\n
"
)
...
...
@@ -506,13 +509,13 @@ func ReadExpectIndependentArr(content string) [][]string {
for
idx
<
len
(
lines
)
{
line
:=
strings
.
TrimSpace
(
lines
[
idx
])
if
line
==
"
>>
"
{
// more than one line
if
line
==
"
{
"
{
// more than one line
currModel
=
"multi"
cpArr
=
make
([]
string
,
0
)
}
else
if
currModel
==
"multi"
{
// in
>> and >>
in multi line mode
}
else
if
currModel
==
"multi"
{
// in
{ and }
in multi line mode
cpArr
=
append
(
cpArr
,
line
)
if
idx
==
len
(
lines
)
-
1
||
strings
.
Index
(
lines
[
idx
+
1
],
">>"
)
>
-
1
{
// end multi line
if
idx
==
len
(
lines
)
-
1
||
strings
.
TrimSpace
(
lines
[
idx
+
1
])
==
"}"
{
// end multi line
temp
:=
make
([]
string
,
0
)
temp
=
append
(
temp
,
strings
.
Join
(
cpArr
,
"
\r\n
"
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录