Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
bd3ce53a
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
bd3ce53a
编写于
3月 22, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
parse case's steps and expects for update
上级
58a9e922
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
127 addition
and
131 deletion
+127
-131
internal/comm/consts/enum.go
internal/comm/consts/enum.go
+7
-0
internal/comm/domain/zentao.go
internal/comm/domain/zentao.go
+8
-0
internal/comm/helper/exec/result.go
internal/comm/helper/exec/result.go
+9
-16
internal/comm/helper/script/parser.go
internal/comm/helper/script/parser.go
+96
-105
internal/comm/helper/zentao/case.go
internal/comm/helper/zentao/case.go
+5
-8
internal/server/modules/v1/service/sync.go
internal/server/modules/v1/service/sync.go
+2
-2
未找到文件。
internal/comm/consts/enum.go
浏览文件 @
bd3ce53a
...
...
@@ -76,6 +76,13 @@ func (OsType) Get(osName string) OsType {
return
OsType
(
osName
)
}
type
CaseStepType
string
const
(
Group
CaseStepType
=
"group"
Item
CaseStepType
=
"item"
)
type
ExecBy
string
const
(
...
...
internal/comm/domain/zentao.go
浏览文件 @
bd3ce53a
package
commDomain
import
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
type
ZentaoUserProfile
struct
{
Id
int
`json:"id"`
Account
string
`json:"account"`
...
...
@@ -7,3 +9,9 @@ type ZentaoUserProfile struct {
Nickname
string
`json:"nickname"`
Avatar
string
`json:"avatar"`
}
type
ZentaoCaseStep
struct
{
Type
commConsts
.
CaseStepType
Desc
string
Expect
string
}
internal/comm/helper/exec/result.go
浏览文件 @
bd3ce53a
...
...
@@ -9,7 +9,6 @@ import (
"github.com/aaronchen2k/deeptest/internal/pkg/lib/i118"
"github.com/aaronchen2k/deeptest/internal/pkg/lib/lang"
logUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
"github.com/emirpasic/gods/maps"
"github.com/fatih/color"
"github.com/kataras/iris/v12/websocket"
"github.com/mattn/go-runewidth"
...
...
@@ -22,14 +21,14 @@ func CheckCaseResult(scriptFile string, logs string, report *commDomain.ZtfRepor
total
int
,
secs
string
,
pathMaxWidth
int
,
numbMaxWidth
int
,
wsMsg
websocket
.
Message
)
{
step
Map
,
_
,
expectMap
,
isOldFormat
:=
scriptHelper
.
GetStepAndExpectMap
(
scriptFile
)
step
s
,
isOldFormat
:=
scriptHelper
.
GetStepAndExpectMap
(
scriptFile
)
isIndependent
,
expectIndependentContent
:=
scriptHelper
.
GetDependentExpect
(
scriptFile
)
if
isIndependent
{
if
isOldFormat
{
expectMap
=
scriptHelper
.
GetExpectMapFromIndependentFileObsolete
(
expectMap
,
expectIndependentContent
,
false
)
scriptHelper
.
GetExpectMapFromIndependentFileObsolete
(
&
steps
,
expectIndependentContent
,
false
)
}
else
{
expectMap
=
scriptHelper
.
GetExpectMapFromIndependentFile
(
expectMap
,
expectIndependentContent
,
false
)
scriptHelper
.
GetExpectMapFromIndependentFile
(
&
steps
,
expectIndependentContent
,
false
)
}
}
...
...
@@ -42,12 +41,12 @@ func CheckCaseResult(scriptFile string, logs string, report *commDomain.ZtfRepor
}
language
:=
langUtils
.
GetLangByFile
(
scriptFile
)
ValidateCaseResult
(
scriptFile
,
language
,
step
Map
,
expectMap
,
skip
,
actualArr
,
report
,
ValidateCaseResult
(
scriptFile
,
language
,
step
s
,
skip
,
actualArr
,
report
,
idx
,
total
,
secs
,
pathMaxWidth
,
numbMaxWidth
,
wsMsg
)
}
func
ValidateCaseResult
(
scriptFile
string
,
langType
string
,
step
Map
,
expectMap
maps
.
Ma
p
,
skip
bool
,
actualArr
[][]
string
,
report
*
commDomain
.
ZtfReport
,
step
s
[]
commDomain
.
ZentaoCaseSte
p
,
skip
bool
,
actualArr
[][]
string
,
report
*
commDomain
.
ZtfReport
,
idx
int
,
total
int
,
secs
string
,
pathMaxWidth
int
,
numbMaxWidth
int
,
wsMsg
websocket
.
Message
)
{
...
...
@@ -60,15 +59,9 @@ func ValidateCaseResult(scriptFile string, langType string,
if
skip
{
caseResult
=
commConsts
.
SKIP
}
else
{
idx
:=
0
for
_
,
numbObj
:=
range
expectMap
.
Keys
()
{
// iterate by checkpoints
stepObj
,
_
:=
stepMap
.
Get
(
numbObj
)
expectObj
,
_
:=
expectMap
.
Get
(
numbObj
)
numb
:=
strings
.
TrimSpace
(
numbObj
.
(
string
))
stepName
:=
strings
.
TrimSpace
(
stepObj
.
(
string
))
expect
:=
strings
.
TrimSpace
(
expectObj
.
(
string
))
for
idx
,
step
:=
range
steps
{
// iterate by checkpoints
stepName
:=
strings
.
TrimSpace
(
step
.
Desc
)
expect
:=
strings
.
TrimSpace
(
step
.
Expect
)
if
expect
==
""
{
continue
...
...
@@ -83,7 +76,7 @@ func ValidateCaseResult(scriptFile string, langType string,
}
stepResult
,
checkpointLogs
:=
ValidateStepResult
(
langType
,
expectLines
,
actualLines
)
stepLog
:=
commDomain
.
StepLog
{
Id
:
str
ings
.
TrimRight
(
numb
,
"."
),
Name
:
stepName
,
Status
:
stepResult
,
CheckPoints
:
checkpointLogs
}
stepLog
:=
commDomain
.
StepLog
{
Id
:
str
conv
.
Itoa
(
idx
),
Name
:
stepName
,
Status
:
stepResult
,
CheckPoints
:
checkpointLogs
}
stepLogs
=
append
(
stepLogs
,
stepLog
)
if
stepResult
==
commConsts
.
FAIL
{
caseResult
=
commConsts
.
FAIL
...
...
internal/comm/helper/script/parser.go
浏览文件 @
bd3ce53a
...
...
@@ -35,7 +35,7 @@ func ReplaceCaseDesc(desc, file string) {
fileUtils
.
WriteFile
(
file
,
out
)
}
func
GetStepAndExpectMap
(
file
string
)
(
step
Map
,
stepTypeMap
,
expectMap
maps
.
Ma
p
,
isOldFormat
bool
)
{
func
GetStepAndExpectMap
(
file
string
)
(
step
s
[]
commDomain
.
ZentaoCaseSte
p
,
isOldFormat
bool
)
{
if
!
fileUtils
.
FileExist
(
file
)
{
return
}
...
...
@@ -50,60 +50,55 @@ func GetStepAndExpectMap(file string) (stepMap, stepTypeMap, expectMap maps.Map,
if
isOldFormat
{
groupBlockArr
:=
getGroupBlockArr
(
lines
)
groupArr
:=
getStepNestedArrObsolete
(
groupBlockArr
)
_
,
step
Map
,
stepTypeMap
,
expectMap
=
getSortedTextFromNestedStepsObsolete
(
groupArr
)
_
,
step
s
=
getSortedTextFromNestedStepsObsolete
(
groupArr
)
}
else
{
groupArr
:=
getStepNestedArr
(
lines
)
_
,
step
Map
,
stepTypeMap
,
expectMap
=
getSortedTextFromNestedSteps
(
groupArr
)
_
,
step
s
=
getSortedTextFromNestedSteps
(
groupArr
)
}
isIndependent
,
expectIndependentContent
:=
GetDependentExpect
(
file
)
if
isIndependent
{
if
isOldFormat
{
expectMap
=
GetExpectMapFromIndependentFileObsolete
(
expectMap
,
expectIndependentContent
,
false
)
GetExpectMapFromIndependentFileObsolete
(
&
steps
,
expectIndependentContent
,
false
)
}
else
{
expectMap
=
GetExpectMapFromIndependentFile
(
expectMap
,
expectIndependentContent
,
false
)
GetExpectMapFromIndependentFile
(
&
steps
,
expectIndependentContent
,
false
)
}
}
return
}
func
GetExpectMap
(
file
string
)
(
expectMap
maps
.
Map
,
ok
bool
)
{
return
}
func
SortFile
(
file
string
)
{
stepsTxt
:=
""
if
fileUtils
.
FileExist
(
file
)
{
txt
:=
fileUtils
.
ReadFile
(
file
)
lang
:=
langUtils
.
GetLangByFile
(
file
)
isOldFormat
:=
strings
.
Index
(
txt
,
"[esac]"
)
>
-
1
info
,
content
:=
ReadCaseInfo
(
txt
,
lang
,
isOldFormat
)
lines
:=
strings
.
Split
(
content
,
"
\n
"
)
groupBlockArr
:=
getGroupBlockArr
(
lines
)
groupArr
:=
getStepNestedArrObsolete
(
groupBlockArr
)
stepsTxt
,
_
,
_
,
_
=
getSortedTextFromNestedStepsObsolete
(
groupArr
)
// replace info
from
:=
""
to
:=
""
if
isOldFormat
{
from
=
`(?s)\[case\].*\[esac\]`
to
=
"[case]
\n
"
+
info
+
"
\n
"
+
stepsTxt
+
"
\n\n
[esac]"
}
else
{
from
=
fmt
.
Sprintf
(
`(?s)%s.*%s`
,
langUtils
.
LangCommentsRegxMap
[
lang
][
0
],
langUtils
.
LangCommentsRegxMap
[
lang
][
1
])
to
=
fmt
.
Sprintf
(
"%s
\n
"
+
info
+
"
\n
"
+
stepsTxt
+
"
\n\n
%s"
,
langUtils
.
LangCommentsRegxMap
[
lang
][
0
],
langUtils
.
LangCommentsRegxMap
[
lang
][
1
])
}
re
,
_
:=
regexp
.
Compile
(
from
)
script
:=
re
.
ReplaceAllString
(
txt
,
to
)
fileUtils
.
WriteFile
(
file
,
script
)
}
}
//func SortFile(file string) {
// stepsTxt := ""
//
// if fileUtils.FileExist(file) {
// txt := fileUtils.ReadFile(file)
// lang := langUtils.GetLangByFile(file)
// isOldFormat := strings.Index(txt, "[esac]") > -1
// info, content := ReadCaseInfo(txt, lang, isOldFormat)
// lines := strings.Split(content, "\n")
//
// groupBlockArr := getGroupBlockArr(lines)
// groupArr := getStepNestedArrObsolete(groupBlockArr)
// stepsTxt, _, _, _ = getSortedTextFromNestedStepsObsolete(groupArr)
//
// // replace info
// from := ""
// to := ""
// if isOldFormat {
// from = `(?s)\[case\].*\[esac\]`
// to = "[case]\n" + info + "\n" + stepsTxt + "\n\n[esac]"
// } else {
// from = fmt.Sprintf(`(?s)%s.*%s`, langUtils.LangCommentsRegxMap[lang][0], langUtils.LangCommentsRegxMap[lang][1])
// to = fmt.Sprintf("%s\n"+info+"\n"+stepsTxt+"\n\n%s",
// langUtils.LangCommentsRegxMap[lang][0], langUtils.LangCommentsRegxMap[lang][1])
// }
// re, _ := regexp.Compile(from)
// script := re.ReplaceAllString(txt, to)
//
// fileUtils.WriteFile(file, script)
// }
//}
func
getGroupBlockArr
(
lines
[]
string
)
[][]
string
{
groupBlockArr
:=
make
([][]
string
,
0
)
...
...
@@ -352,11 +347,8 @@ func isGroup(str string) bool {
return
ret
}
func
getSortedTextFromNestedStepsObsolete
(
groups
[]
commDomain
.
ZtfStep
)
(
st
ring
,
maps
.
Map
,
maps
.
Map
,
maps
.
Ma
p
)
{
func
getSortedTextFromNestedStepsObsolete
(
groups
[]
commDomain
.
ZtfStep
)
(
st
epsText
string
,
steps
[]
commDomain
.
ZentaoCaseSte
p
)
{
ret
:=
make
([]
string
,
0
)
stepMap
:=
linkedhashmap
.
New
()
stepTypeMap
:=
linkedhashmap
.
New
()
expectMap
:=
linkedhashmap
.
New
()
groupNumb
:=
1
for
_
,
group
:=
range
groups
{
...
...
@@ -366,8 +358,7 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
ret
=
append
(
ret
,
"
\n
"
+
desc
)
for
idx
,
child
:=
range
group
.
Children
{
// level 1 item
numbStr
:=
getNumbStr
(
groupNumb
,
-
1
)
stepTypeMap
.
Put
(
numbStr
,
"item"
)
step
:=
commDomain
.
ZentaoCaseStep
{}
if
group
.
MultiLine
{
// steps
...
...
@@ -376,7 +367,8 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
stepTxt
:=
printMutiStepOrExpect
(
child
.
Desc
)
ret
=
append
(
ret
,
stepTxt
)
stepMap
.
Put
(
numbStr
,
stepTxt
)
step
.
Desc
=
stepTxt
// expects
tag
=
replaceNumb
(
"[expects]"
,
groupNumb
,
-
1
,
true
)
...
...
@@ -387,15 +379,18 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
if
idx
<
len
(
group
.
Children
)
-
1
{
ret
=
append
(
ret
,
""
)
}
expectMap
.
Put
(
numbStr
,
expectTxt
)
step
.
Expect
=
expectTxt
}
else
{
stepTxt
:=
strings
.
TrimSpace
(
child
.
Desc
)
stepTxtWithNumb
:=
replaceNumb
(
stepTxt
,
groupNumb
,
-
1
,
false
)
stepMap
.
Put
(
numbStr
,
stepTxt
)
step
.
Desc
=
stepTxt
expectTxt
:=
child
.
Expect
expectTxt
=
strings
.
TrimSpace
(
expectTxt
)
expectMap
.
Put
(
numbStr
,
expectTxt
)
step
.
Expect
=
expectTxt
if
expectTxt
!=
""
{
expectTxt
=
">> "
+
expectTxt
...
...
@@ -404,21 +399,27 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
ret
=
append
(
ret
,
fmt
.
Sprintf
(
" %s %s"
,
stepTxtWithNumb
,
expectTxt
))
}
steps
=
append
(
steps
,
step
)
groupNumb
++
}
}
else
{
groupStep
:=
commDomain
.
ZentaoCaseStep
{}
desc
=
replaceNumb
(
group
.
Desc
,
groupNumb
,
-
1
,
true
)
ret
=
append
(
ret
,
"
\n
"
+
desc
)
numbStr
:=
getNumbStr
(
groupNumb
,
-
1
)
stepMap
.
Put
(
numbStr
,
getGroupName
(
group
.
Desc
))
stepTypeMap
.
Put
(
numbStr
,
"group"
)
expectMap
.
Put
(
numbStr
,
""
)
groupStep
.
Type
=
commConsts
.
Group
groupStep
.
Desc
=
getGroupName
(
group
.
Desc
)
groupStep
.
Expect
=
""
steps
=
append
(
steps
,
groupStep
)
childNumb
:=
1
for
_
,
child
:=
range
group
.
Children
{
numbStr
:=
getNumbStr
(
groupNumb
,
childNumb
)
stepTypeMap
.
Put
(
numbStr
,
"item"
)
itemStep
:=
commDomain
.
ZentaoCaseStep
{}
itemStep
.
Type
=
commConsts
.
Item
if
group
.
MultiLine
{
// steps
...
...
@@ -427,7 +428,8 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
stepTxt
:=
printMutiStepOrExpect
(
child
.
Desc
)
ret
=
append
(
ret
,
stepTxt
)
stepMap
.
Put
(
numbStr
,
stepTxt
)
itemStep
.
Desc
=
stepTxt
// expects
tag
=
replaceNumb
(
"[expects]"
,
groupNumb
,
childNumb
,
true
)
...
...
@@ -435,14 +437,15 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
expectTxt
:=
printMutiStepOrExpect
(
child
.
Expect
)
ret
=
append
(
ret
,
expectTxt
)
expectMap
.
Put
(
numbStr
,
expectTxt
)
itemStep
.
Expect
=
expectTxt
}
else
{
stepTxt
:=
strings
.
TrimSpace
(
child
.
Desc
)
stepMap
.
Put
(
numbStr
,
stepTxt
)
itemStep
.
Desc
=
stepTxt
expectTxt
:=
child
.
Expect
expectTxt
=
strings
.
TrimSpace
(
expectTxt
)
expectMap
.
Put
(
numbStr
,
expectTxt
)
itemStep
.
Expect
=
expectTxt
if
expectTxt
!=
""
{
expectTxt
=
">> "
+
expectTxt
...
...
@@ -458,46 +461,51 @@ func getSortedTextFromNestedStepsObsolete(groups []commDomain.ZtfStep) (string,
}
}
return
strings
.
Join
(
ret
,
"
\n
"
),
stepMap
,
stepTypeMap
,
expectMap
stepsText
=
strings
.
Join
(
ret
,
"
\n
"
)
return
}
func
getSortedTextFromNestedSteps
(
groups
[]
commDomain
.
ZtfStep
)
(
ret
string
,
step
Map
,
stepTypeMap
,
expectMap
maps
.
Ma
p
)
{
func
getSortedTextFromNestedSteps
(
groups
[]
commDomain
.
ZtfStep
)
(
ret
string
,
step
s
[]
commDomain
.
ZentaoCaseSte
p
)
{
arr
:=
make
([]
string
,
0
)
stepMap
=
linkedhashmap
.
New
()
stepTypeMap
=
linkedhashmap
.
New
()
expectMap
=
linkedhashmap
.
New
()
for
idx1
,
group
:=
range
groups
{
numbStr
:=
getNumbStr
(
idx1
+
1
,
-
1
)
stepType
:=
"step"
for
_
,
group
:=
range
groups
{
step
:=
commDomain
.
ZentaoCaseStep
{}
stepType
:=
commConsts
.
Item
if
len
(
group
.
Children
)
>
0
{
stepType
=
"group"
stepType
=
commConsts
.
Group
}
step
TypeMap
.
Put
(
numbStr
,
stepType
)
step
.
Type
=
stepType
stepTxt
:=
strings
.
TrimSpace
(
group
.
Desc
)
step
Map
.
Put
(
numbStr
,
stepTxt
)
step
.
Desc
=
stepTxt
expectTxt
:=
strings
.
TrimSpace
(
group
.
Expect
)
expectTxt
=
strings
.
TrimRight
(
expectTxt
,
"]]"
)
expectTxt
=
strings
.
TrimSpace
(
expectTxt
)
expectMap
.
Put
(
numbStr
,
expectTxt
)
step
.
Expect
=
expectTxt
steps
=
append
(
steps
,
step
)
if
expectTxt
!=
""
{
expectTxt
=
">> "
+
expectTxt
}
arr
=
append
(
arr
,
fmt
.
Sprintf
(
" %s %s"
,
stepTxt
,
expectTxt
))
for
idx2
,
child
:=
range
group
.
Children
{
numbStr
:=
getNumbStr
(
idx1
+
1
,
idx2
+
1
)
stepTypeMap
.
Put
(
numbStr
,
"item"
)
for
_
,
child
:=
range
group
.
Children
{
stepChild
:=
commDomain
.
ZentaoCaseStep
{}
stepChild
.
Type
=
commConsts
.
Item
stepTxt
:=
strings
.
TrimSpace
(
child
.
Desc
)
step
Map
.
Put
(
numbStr
,
stepTxt
)
step
Child
.
Desc
=
stepTxt
expectTxt
:=
strings
.
TrimSpace
(
child
.
Expect
)
expectMap
.
Put
(
numbStr
,
expectTxt
)
stepChild
.
Expect
=
expectTxt
steps
=
append
(
steps
,
step
)
if
expectTxt
!=
""
{
expectTxt
=
">> "
+
expectTxt
...
...
@@ -558,49 +566,32 @@ func printMutiStepOrExpect(str string) string {
return
strings
.
Join
(
ret
,
"
\r\n
"
)
}
func
GetExpectMapFromIndependentFileObsolete
(
expectMap
maps
.
Map
,
content
string
,
withEmptyExpect
bool
)
maps
.
Map
{
retMap
:=
linkedhashmap
.
New
()
func
GetExpectMapFromIndependentFileObsolete
(
steps
*
[]
commDomain
.
ZentaoCaseStep
,
content
string
,
withEmptyExpect
bool
)
{
expectArr
:=
ReadExpectIndependentArrObsolete
(
content
)
idx
:=
0
for
_
,
keyIfs
:=
range
expectMap
.
Keys
()
{
valueIfs
,
_
:=
expectMap
.
Get
(
keyIfs
)
key
:=
strings
.
TrimSpace
(
keyIfs
.
(
string
))
value
:=
strings
.
TrimSpace
(
valueIfs
.
(
string
))
if
value
==
""
&&
len
(
expectArr
)
>
idx
{
retMap
.
Put
(
key
,
strings
.
Join
(
expectArr
[
idx
],
"
\r\n
"
))
idx
++
for
idx
,
step
:=
range
*
steps
{
if
len
(
expectArr
)
>
idx
{
step
.
Expect
=
strings
.
Join
(
expectArr
[
idx
],
"
\r\n
"
)
}
else
{
if
withEmptyExpect
{
retMap
.
Put
(
key
,
""
)
step
.
Expect
=
""
}
}
}
return
retMap
}
func
GetExpectMapFromIndependentFile
(
expectMap
maps
.
Ma
p
,
content
string
,
withEmptyExpect
bool
)
maps
.
Map
{
func
GetExpectMapFromIndependentFile
(
steps
*
[]
commDomain
.
ZentaoCaseSte
p
,
content
string
,
withEmptyExpect
bool
)
maps
.
Map
{
retMap
:=
linkedhashmap
.
New
()
expectArr
:=
ReadExpectIndependentArr
(
content
)
idx
:=
0
for
_
,
keyIfs
:=
range
expectMap
.
Keys
()
{
valueIfs
,
_
:=
expectMap
.
Get
(
keyIfs
)
key
:=
strings
.
TrimSpace
(
keyIfs
.
(
string
))
value
:=
strings
.
TrimSpace
(
valueIfs
.
(
string
))
if
value
==
"pass"
&&
len
(
expectArr
)
>
idx
{
retMap
.
Put
(
key
,
strings
.
Join
(
expectArr
[
idx
],
"
\r\n
"
))
for
idx
,
step
:=
range
*
steps
{
if
len
(
expectArr
)
>
idx
{
// && value == "pass" {
step
.
Expect
=
strings
.
Join
(
expectArr
[
idx
],
"
\r\n
"
)
idx
++
}
else
{
if
withEmptyExpect
{
retMap
.
Put
(
key
,
""
)
step
.
Expect
=
""
}
}
}
...
...
internal/comm/helper/zentao/case.go
浏览文件 @
bd3ce53a
...
...
@@ -7,20 +7,18 @@ import (
"github.com/aaronchen2k/deeptest/internal/comm/domain"
configUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/config"
scriptUtils
"github.com/aaronchen2k/deeptest/internal/comm/helper/script"
commonUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
httpUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/http"
i118Utils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/i118"
logUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
stdinUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/stdin"
"github.com/bitly/go-simplejson"
"github.com/emirpasic/gods/maps"
"sort"
"strconv"
"strings"
)
func
CommitCase
(
caseId
int
,
title
string
,
step
Map
maps
.
Map
,
stepTypeMap
maps
.
Map
,
expectMap
maps
.
Ma
p
,
workspacePath
string
)
(
err
error
)
{
step
s
[]
commDomain
.
ZentaoCaseSte
p
,
workspacePath
string
)
(
err
error
)
{
config
:=
configUtils
.
LoadByWorkspacePath
(
workspacePath
)
err
=
Login
(
config
)
...
...
@@ -32,11 +30,10 @@ func CommitCase(caseId int, title string,
url
:=
GenApiUrl
(
uri
,
nil
,
config
.
Url
)
requestObj
:=
map
[
string
]
interface
{}{
"type"
:
"feature"
,
"title"
:
title
,
"steps"
:
commonUtils
.
LinkedMapToMap
(
stepMap
),
"stepType"
:
commonUtils
.
LinkedMapToMap
(
stepTypeMap
),
"expects"
:
commonUtils
.
LinkedMapToMap
(
expectMap
)}
"type"
:
"feature"
,
"title"
:
title
,
"steps"
:
steps
,
}
json
,
err
:=
json
.
Marshal
(
requestObj
)
if
err
!=
nil
{
...
...
internal/server/modules/v1/service/sync.go
浏览文件 @
bd3ce53a
...
...
@@ -73,12 +73,12 @@ func (s *SyncService) SyncToZentao(workspacePath string, commitProductId int) (e
pass
,
id
,
_
,
title
:=
scriptUtils
.
GetCaseInfo
(
cs
)
if
pass
{
step
Map
,
stepTypeMap
,
expectMap
,
isOldFormat
:=
scriptUtils
.
GetStepAndExpectMap
(
cs
)
step
s
,
isOldFormat
:=
scriptUtils
.
GetStepAndExpectMap
(
cs
)
if
commConsts
.
Verbose
{
logUtils
.
Infof
(
"isOldFormat = "
,
isOldFormat
)
}
zentaoUtils
.
CommitCase
(
id
,
title
,
step
Map
,
stepTypeMap
,
expectMap
,
workspacePath
)
zentaoUtils
.
CommitCase
(
id
,
title
,
step
s
,
workspacePath
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录