Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
3cfc2341
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 搜索 >>
提交
3cfc2341
编写于
3月 23, 2023
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync cases with new format
上级
8e78cf41
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
19 deletion
+23
-19
demo/t/1_simple.php
demo/t/1_simple.php
+1
-1
demo/t/9_new_format.php
demo/t/9_new_format.php
+7
-4
internal/pkg/helper/script/generator.go
internal/pkg/helper/script/generator.go
+13
-13
internal/pkg/helper/script/parser.go
internal/pkg/helper/script/parser.go
+1
-1
internal/pkg/helper/zentao/case.go
internal/pkg/helper/zentao/case.go
+1
-0
未找到文件。
demo/t/1_simple.php
浏览文件 @
3cfc2341
...
...
@@ -3,7 +3,7 @@
/**
title = simple demo
cid=
1
cid=
3
pid=1
step1 >> expect 1
...
...
demo/t/9_new_format.php
浏览文件 @
3cfc2341
...
...
@@ -3,15 +3,18 @@
/**
测试用例标题 #
2
测试用例标题 #
1
- 步骤1 @期待结果1
- 步骤2
- 子步骤2.1 @{
期待结果2.1.
1
期待结果2.1.
2
期待结果2.1-
1
期待结果2.1-
2
}
- 子步骤2.2 @期待结果2.2
- 子步骤2.2 @{
期待结果2.2-1
期待结果2.2-2
}
- 步骤3
- 步骤4 @期待结果3
*/
...
...
internal/pkg/helper/script/generator.go
浏览文件 @
3cfc2341
...
...
@@ -49,7 +49,7 @@ func GenerateScript(cs commDomain.ZtfCase, langType string, independentFile bool
targetDir
string
,
byModule
bool
)
(
scriptPath
string
,
err
error
)
{
caseId
:=
cs
.
Id
productId
:=
cs
.
Product
//
productId := cs.Product
moduleId
:=
cs
.
Module
caseTitle
:=
cs
.
Title
...
...
@@ -72,9 +72,9 @@ func GenerateScript(cs commDomain.ZtfCase, langType string, independentFile bool
i118Utils
.
Sprintf
(
"find_example"
,
consts
.
FilePthSep
,
langType
))
info
=
append
(
info
,
fmt
.
Sprintf
(
"title=%s"
,
caseTitle
))
info
=
append
(
info
,
fmt
.
Sprintf
(
"timeout=%d"
,
0
))
//
info = append(info, fmt.Sprintf("timeout=%d", 0))
info
=
append
(
info
,
fmt
.
Sprintf
(
"cid=%d"
,
caseId
))
info
=
append
(
info
,
fmt
.
Sprintf
(
"pid=%d"
,
productId
))
//
info = append(info, fmt.Sprintf("pid=%d", productId))
StepWidth
:=
20
stepDisplayMaxWidth
:=
0
...
...
@@ -142,7 +142,7 @@ func generateTestStepAndScript(testSteps []commDomain.ZtfStep, steps *[]string,
*
steps
=
append
(
*
steps
,
""
)
for
_
,
item
:=
range
nestedSteps
{
numbStr
:=
fmt
.
Sprintf
(
"%d"
,
stepNumb
)
stepLines1
,
expects1
:=
getCaseContent
(
item
,
numbStr
,
independentFile
,
false
)
stepLines1
,
expects1
:=
getCase
Step
Content
(
item
,
numbStr
,
independentFile
,
false
)
*
steps
=
append
(
*
steps
,
stepLines1
)
if
independentFile
&&
strings
.
TrimSpace
(
item
.
Expect
)
!=
""
{
...
...
@@ -151,7 +151,7 @@ func generateTestStepAndScript(testSteps []commDomain.ZtfStep, steps *[]string,
for
childNo
,
child
:=
range
item
.
Children
{
numbStr
:=
fmt
.
Sprintf
(
"%d.%d"
,
stepNumb
,
childNo
+
1
)
stepLines2
,
expects2
:=
getCaseContent
(
child
,
numbStr
,
independentFile
,
true
)
stepLines2
,
expects2
:=
getCase
Step
Content
(
child
,
numbStr
,
independentFile
,
true
)
*
steps
=
append
(
*
steps
,
stepLines2
)
if
independentFile
&&
strings
.
TrimSpace
(
child
.
Expect
)
!=
""
{
...
...
@@ -179,7 +179,7 @@ func GenSuite(cases []string, targetDir string) {
fileUtils
.
WriteFile
(
targetDir
+
"all."
+
commConsts
.
ExtNameSuite
,
str
)
}
func
getCaseContent
(
stepObj
commDomain
.
ZtfStep
,
seq
string
,
independentFile
bool
,
isChild
bool
)
(
func
getCase
Step
Content
(
stepObj
commDomain
.
ZtfStep
,
seq
string
,
independentFile
bool
,
isChild
bool
)
(
stepContent
,
expectContent
string
)
{
step
:=
strings
.
TrimSpace
(
stepObj
.
Desc
)
...
...
@@ -206,7 +206,7 @@ func getCaseContent(stepObj commDomain.ZtfStep, seq string, independentFile bool
}
func
getStepContent
(
str
string
,
isChild
bool
)
(
ret
string
)
{
str
=
strings
.
TrimSpace
(
str
)
str
=
" - "
+
strings
.
TrimSpace
(
str
)
rpl
:=
"
\n
"
if
isChild
{
...
...
@@ -230,7 +230,7 @@ func getExpectContent(str string, isChild bool, independentFile bool) (ret strin
if
independentFile
{
ret
=
str
}
else
{
ret
=
"
>>
"
+
str
ret
=
"
@
"
+
str
}
}
else
{
// multi-line
rpl
:=
"
\r\n
"
...
...
@@ -248,15 +248,15 @@ 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
>>
//step 1.2
@{
// expect 1.2 line 1
// expect 1.2 line 2
//
>>
ret
=
"
>>
\n
"
+
spaceBeforeText
+
//
}
ret
=
"
@{
\n
"
+
spaceBeforeText
+
strings
.
ReplaceAll
(
str
,
rpl
,
rpl
+
spaceBeforeText
)
+
"
\n
"
+
spaceBeforeTerminator
+
"
>>
"
"
\n
"
+
spaceBeforeTerminator
+
"
}
"
}
}
...
...
internal/pkg/helper/script/parser.go
浏览文件 @
3cfc2341
...
...
@@ -305,7 +305,7 @@ func ReplaceCaseDesc(desc, file string) {
content
:=
fileUtils
.
ReadFile
(
file
)
lang
:=
langHelper
.
GetLangByFile
(
file
)
regStr
:=
fmt
.
Sprintf
(
`(?smU)%s((?U:.*
p
id.*))\n(.*)%s`
,
regStr
:=
fmt
.
Sprintf
(
`(?smU)%s((?U:.*
c
id.*))\n(.*)%s`
,
commConsts
.
LangCommentsRegxMap
[
lang
][
0
],
commConsts
.
LangCommentsRegxMap
[
lang
][
1
])
re
,
_
:=
regexp
.
Compile
(
regStr
)
...
...
internal/pkg/helper/zentao/case.go
浏览文件 @
3cfc2341
...
...
@@ -300,6 +300,7 @@ func LoadTestCasesDetailByCaseIds(caseIds []int,
func
GetTestCaseDetail
(
caseId
int
,
config
commDomain
.
WorkspaceConf
)
(
cs
commDomain
.
ZtfCase
,
err
error
)
{
csWithSteps
,
err
:=
GetCaseById
(
config
.
Url
,
caseId
)
stepArr
:=
genCaseSteps
(
csWithSteps
)
cs
=
commDomain
.
ZtfCase
{
Id
:
caseId
,
Product
:
csWithSteps
.
Product
,
Module
:
csWithSteps
.
Module
,
Title
:
csWithSteps
.
Title
,
Steps
:
stepArr
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录