Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
9d3350af
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
9d3350af
编写于
6月 20, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issues
上级
cb5b3fe8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
41 addition
and
27 deletion
+41
-27
internal/pkg/helper/script/parser.go
internal/pkg/helper/script/parser.go
+7
-7
internal/pkg/helper/zentao/case.go
internal/pkg/helper/zentao/case.go
+5
-0
internal/pkg/helper/zentao/sync.go
internal/pkg/helper/zentao/sync.go
+7
-5
internal/server/modules/v1/controller/test-script.go
internal/server/modules/v1/controller/test-script.go
+11
-9
ui/src/locales/en-US.ts
ui/src/locales/en-US.ts
+1
-1
ui/src/locales/zh-CN.ts
ui/src/locales/zh-CN.ts
+1
-1
ui/src/views/script/WorkDir.vue
ui/src/views/script/WorkDir.vue
+9
-4
未找到文件。
internal/pkg/helper/script/parser.go
浏览文件 @
9d3350af
...
...
@@ -698,14 +698,10 @@ func ScriptToExpectName(file string) string {
// return runName
//}
func
GetCaseInfo
(
file
string
)
(
bool
,
int
,
int
,
string
)
{
var
caseId
int
var
productId
int
var
title
string
func
GetCaseInfo
(
file
string
)
(
pass
bool
,
caseId
,
productId
int
,
title
string
)
{
content
:=
fileUtils
.
ReadFile
(
file
)
isOldFormat
:=
strings
.
Index
(
content
,
"[esac]"
)
>
-
1
pass
:
=
CheckFileContentIsScript
(
content
)
pass
=
CheckFileContentIsScript
(
content
)
if
!
pass
{
return
false
,
caseId
,
productId
,
title
}
...
...
@@ -745,7 +741,11 @@ func GetCaseInfo(file string) (bool, int, int, string) {
title
=
strings
.
TrimSpace
(
arr
[
1
])
}
return
pass
,
caseId
,
productId
,
title
if
caseId
<=
0
{
pass
=
false
}
return
}
//func ReadScriptCheckpoints(file string) ([]string, [][]string) {
...
...
internal/pkg/helper/zentao/case.go
浏览文件 @
9d3350af
...
...
@@ -29,6 +29,11 @@ func CommitCase(caseId int, title string,
return
}
_
,
err
=
GetCaseById
(
config
.
Url
,
caseId
)
if
err
!=
nil
{
return
}
uri
:=
fmt
.
Sprintf
(
"/testcases/%d"
,
caseId
)
url
:=
GenApiUrl
(
uri
,
nil
,
config
.
Url
)
...
...
internal/pkg/helper/zentao/sync.go
浏览文件 @
9d3350af
...
...
@@ -66,15 +66,17 @@ func SyncFromZentao(settings commDomain.SyncSettings, config commDomain.Workspac
return
}
func
SyncToZentao
(
cases
[]
string
,
config
commDomain
.
WorkspaceConf
)
(
err
error
)
{
count
:=
0
func
SyncToZentao
(
cases
[]
string
,
config
commDomain
.
WorkspaceConf
)
(
count
int
,
err
error
)
{
for
_
,
cs
:=
range
cases
{
pass
,
id
,
_
,
title
:=
scriptHelper
.
GetCaseInfo
(
cs
)
if
!
pass
{
continue
}
if
pass
&&
id
>
0
{
steps
,
_
:=
scriptHelper
.
GetStepAndExpectMap
(
cs
)
CommitCase
(
id
,
title
,
steps
,
config
)
steps
,
_
:=
scriptHelper
.
GetStepAndExpectMap
(
cs
)
err
=
CommitCase
(
id
,
title
,
steps
,
config
)
if
err
==
nil
{
count
++
}
}
...
...
internal/server/modules/v1/controller/test-script.go
浏览文件 @
9d3350af
...
...
@@ -246,18 +246,20 @@ func (c *TestScriptCtrl) SyncToZentao(ctx iris.Context) {
site
,
_
:=
c
.
SiteService
.
Get
(
uint
(
currSiteId
))
config
:=
configHelper
.
LoadBySite
(
site
)
totalNum
:=
0
successNum
:=
0
for
_
,
set
:=
range
sets
{
// workspaceId := set.WorkspaceId
// workspace, _ := c.WorkspaceService.Get(uint(workspaceId))
err
:=
zentaoHelper
.
SyncToZentao
(
set
.
Cases
,
config
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
CommErr
,
err
.
Error
()))
return
}
totalNum
+=
len
(
set
.
Cases
)
count
,
_
:=
zentaoHelper
.
SyncToZentao
(
set
.
Cases
,
config
)
successNum
+=
count
}
ctx
.
JSON
(
c
.
SuccessResp
(
nil
))
ctx
.
JSON
(
c
.
SuccessResp
(
iris
.
Map
{
"total"
:
totalNum
,
"success"
:
successNum
,
}))
}
// Get 根据报告获取用例编号的列表
...
...
ui/src/locales/en-US.ts
浏览文件 @
9d3350af
...
...
@@ -184,7 +184,7 @@ export default {
'
extract_success
'
:
'
Extract comments to test steps and checkpoints successfully.
'
,
'
extract_none
'
:
'
Not found any test steps in script comments.
'
,
'
extract_fail
'
:
'
Extract comments to test steps and checkpoints failed.
'
,
'
sync_success
'
:
'
S
ync successfully
.
'
,
'
sync_success
'
:
'
S
uccess to sync {success} cases to Zentao, ignore {ignore} cases
.
'
,
'
sync_fail
'
:
'
Sync failed.
'
,
'
by_workspace
'
:
'
By WorkDir
'
,
'
by_module
'
:
'
By Module
'
,
...
...
ui/src/locales/zh-CN.ts
浏览文件 @
9d3350af
...
...
@@ -191,7 +191,7 @@ export default {
'
extract_success
'
:
'
提取注释为测试步骤和验证点成功。
'
,
'
extract_none
'
:
'
脚本中未发现测试步骤。
'
,
'
extract_fail
'
:
'
提取注释为测试步骤和验证点失败。
'
,
'
sync_success
'
:
'
同步成功
'
,
'
sync_success
'
:
'
成功同步{success}个用例到禅道,忽略{ignore}个。
'
,
'
sync_fail
'
:
'
同步失败
'
,
'
by_workspace
'
:
'
按目录
'
,
'
by_module
'
:
'
按模块
'
,
...
...
ui/src/views/script/WorkDir.vue
浏览文件 @
9d3350af
...
...
@@ -467,8 +467,6 @@ const menuClick = (menuKey: string, targetId: number) => {
if
(
menuKey
===
'
exec
'
){
execScript
(
contextNodeData
)
}
else
if
(
menuKey
==
'
sync-from-zentao
'
){
syncFromZentao
(
contextNodeData
)
}
else
if
(
menuKey
===
'
copy
'
||
menuKey
===
'
cut
'
)
{
clipboardAction
.
value
=
menuKey
clipboardData
.
value
=
contextNodeData
...
...
@@ -498,7 +496,9 @@ const menuClick = (menuKey: string, targetId: number) => {
store
.
dispatch
(
'
Script/deleteScript
'
,
contextNodeData
.
id
)
},
});
}
else
if
(
menuKey
===
'
sync-to-zentao
'
){
}
else
if
(
menuKey
==
'
sync-from-zentao
'
){
syncFromZentao
(
contextNodeData
)
}
else
if
(
menuKey
===
'
sync-to-zentao
'
){
checkinCases
(
contextNodeData
)
}
else
{
clipboardAction
.
value
=
''
...
...
@@ -525,7 +525,12 @@ const checkinCases = (node) => {
const
workspaceWithScripts
=
genWorkspaceToScriptsMap
(
fileNodes
)
store
.
dispatch
(
'
Script/syncToZentao
'
,
workspaceWithScripts
).
then
((
resp
=>
{
if
(
resp
.
code
===
0
)
{
notification
.
success
({
message
:
t
(
'
sync_success
'
)});
notification
.
success
({
message
:
t
(
'
sync_success
'
,
{
success
:
resp
.
data
.
success
,
ignore
:
resp
.
data
.
total
-
resp
.
data
.
success
}
)});
}
else
{
notification
.
error
({
message
:
t
(
'
sync_fail
'
),
description
:
resp
.
data
.
msg
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录