Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
3bc9a913
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
10 个月 前同步成功
通知
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 搜索 >>
提交
3bc9a913
编写于
5月 04, 2023
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support jacoco
上级
1352a079
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
200 addition
and
1 deletion
+200
-1
cmd/command/main.go
cmd/command/main.go
+5
-0
internal/pkg/consts/var.go
internal/pkg/consts/var.go
+1
-0
internal/pkg/domain/testing-jacoco.go
internal/pkg/domain/testing-jacoco.go
+66
-0
internal/pkg/helper/exec/exec.go
internal/pkg/helper/exec/exec.go
+1
-0
internal/pkg/helper/exec/report-jacoco.go
internal/pkg/helper/exec/report-jacoco.go
+47
-0
internal/pkg/helper/exec/unit.go
internal/pkg/helper/exec/unit.go
+6
-1
res/server/en/messages.json
res/server/en/messages.json
+4
-0
res/server/zh/messages.json
res/server/zh/messages.json
+4
-0
xdoc/jacoco/jacoco.xml
xdoc/jacoco/jacoco.xml
+66
-0
未找到文件。
cmd/command/main.go
浏览文件 @
3bc9a913
...
...
@@ -82,6 +82,8 @@ func main() {
flagSet
.
StringVar
(
&
unitTestTool
,
"unitTestTool"
,
""
,
""
)
flagSet
.
StringVar
(
&
unitBuildTool
,
"unitBuildTool"
,
""
,
""
)
flagSet
.
StringVar
(
&
commConsts
.
JacocoReport
,
"jacocoReport"
,
""
,
""
)
flagSet
.
StringVar
(
&
keywords
,
"k"
,
""
,
""
)
flagSet
.
StringVar
(
&
keywords
,
"keywords"
,
""
,
""
)
...
...
@@ -265,6 +267,9 @@ func runUnitTest(args []string) {
if
commConsts
.
AllureReportDir
!=
""
{
start
=
start
+
2
}
if
commConsts
.
JacocoReport
!=
""
{
start
=
start
+
2
}
if
unitTestTool
!=
""
{
start
=
start
+
2
}
...
...
internal/pkg/consts/var.go
浏览文件 @
3bc9a913
...
...
@@ -27,6 +27,7 @@ var (
UnitBuildTool
BuildTool
UnitTestTool
TestTool
AllureReportDir
string
JacocoReport
string
ProductId
string
ZenTaoVersion
string
...
...
internal/pkg/domain/testing-jacoco.go
0 → 100644
浏览文件 @
3bc9a913
package
commDomain
type
JacocoReport
struct
{
Sessioninfo
JacocoSessioninfo
`xml:"sessioninfo"`
Package
JacocoPackage
`xml:"package"`
Counter
[]
JacocoCounter
`xml:"counter"`
Name
string
`xml:"name,attr"`
}
type
JacocoCounter
struct
{
Type
Type
`xml:"type,attr"`
Missed
string
`xml:"missed,attr"`
Covered
string
`xml:"covered,attr"`
}
type
JacocoPackage
struct
{
Class
JacocoClassClass
`xml:"class"`
Sourcefile
JacocoSourcefile
`xml:"sourcefile"`
Counter
[]
JacocoCounter
`xml:"counter"`
Name
string
`xml:"name,attr"`
}
type
JacocoClassClass
struct
{
Method
[]
JacocoMethodElement
`xml:"method"`
Counter
[]
JacocoCounter
`xml:"counter"`
Name
string
`xml:"name,attr"`
Sourcefilename
string
`xml:"sourcefilename,attr"`
}
type
JacocoMethodElement
struct
{
Counter
[]
JacocoCounter
`xml:"counter"`
Name
string
`xml:"name,attr"`
Desc
string
`xml:"desc,attr"`
Line
string
`xml:"line,attr"`
}
type
JacocoSourcefile
struct
{
Line
[]
JacocoLineElement
`xml:"line"`
Counter
[]
JacocoCounter
`xml:"counter"`
Name
string
`xml:"name,attr"`
}
type
JacocoLineElement
struct
{
Nr
string
`xml:"nr,attr"`
Mi
string
`xml:"mi,attr"`
Ci
string
`xml:"ci,attr"`
MB
string
`xml:"mb,attr"`
Cb
string
`xml:"cb,attr"`
}
type
JacocoSessioninfo
struct
{
ID
string
`xml:"id,attr"`
Start
string
`xml:"start,attr"`
Dump
string
`xml:"dump,attr"`
}
type
Type
string
const
(
Branch
Type
=
"BRANCH"
Class
Type
=
"CLASS"
Complexity
Type
=
"COMPLEXITY"
Instruction
Type
=
"INSTRUCTION"
Line
Type
=
"LINE"
Method
Type
=
"METHOD"
)
internal/pkg/helper/exec/exec.go
浏览文件 @
3bc9a913
...
...
@@ -35,6 +35,7 @@ func Exec(ch chan int, req serverDomain.ExecReq, msg *websocket.Message) (
ExecUnit
(
ch
,
testSet
,
msg
)
}
}()
// for defer
}
return
...
...
internal/pkg/helper/exec/report-jacoco.go
0 → 100644
浏览文件 @
3bc9a913
package
execHelper
import
(
"encoding/xml"
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
commDomain
"github.com/easysoft/zentaoatf/internal/pkg/domain"
dateUtils
"github.com/easysoft/zentaoatf/pkg/lib/date"
fileUtils
"github.com/easysoft/zentaoatf/pkg/lib/file"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
"github.com/fatih/color"
"time"
)
const
(
Tmpl
=
`Counter Missed Covered
------------------------------------------
%11s %s %s
%11s %s %s
%11s %s %s
%11s %s %s
%11s %s %s
%11s %s %s
`
)
func
GenJacocoCovReport
()
(
report
commDomain
.
JacocoReport
)
{
content
:=
fileUtils
.
ReadFileBuf
(
commConsts
.
JacocoReport
)
xml
.
Unmarshal
(
content
,
&
report
)
var
params
[]
interface
{}
for
_
,
counter
:=
range
report
.
Counter
{
params
=
append
(
params
,
string
(
counter
.
Type
))
params
=
append
(
params
,
counter
.
Missed
)
params
=
append
(
params
,
counter
.
Covered
)
}
title
:=
i118Utils
.
Sprintf
(
"jacoco_report"
)
msg
:=
dateUtils
.
DateTimeStr
(
time
.
Now
())
+
" "
+
title
+
"
\n
"
+
i118Utils
.
Sprintf
(
Tmpl
,
params
...
)
logUtils
.
ExecConsole
(
color
.
FgCyan
,
msg
)
logUtils
.
ExecResult
(
msg
)
return
}
internal/pkg/helper/exec/unit.go
浏览文件 @
3bc9a913
...
...
@@ -41,7 +41,7 @@ func ExecUnit(ch chan int,
iris
.
Map
{
"key"
:
key
,
"status"
:
"start"
},
wsMsg
)
}
//deal with
-allureReportDir param
//deal with -allureReportDir param
arr
:=
strings
.
Split
(
req
.
Cmd
,
" "
)
if
len
(
arr
)
>
1
&&
strings
.
TrimSpace
(
arr
[
0
])
==
"-allureReportDir"
{
commConsts
.
AllureReportDir
=
arr
[
1
]
...
...
@@ -74,6 +74,11 @@ func ExecUnit(ch chan int,
// gen report
report
:=
GenUnitTestReport
(
req
,
startTime
.
Unix
(),
entTime
.
Unix
(),
ch
,
wsMsg
)
// dealwith jacoco report
if
commConsts
.
JacocoReport
!=
""
{
GenJacocoCovReport
()
}
// submit result
if
req
.
SubmitResult
&&
(
report
.
FuncResult
!=
nil
||
report
.
UnitResult
!=
nil
)
{
configDir
:=
req
.
WorkspacePath
...
...
res/server/en/messages.json
浏览文件 @
3bc9a913
...
...
@@ -726,6 +726,10 @@
{
"id"
:
"pls_check_zentao_url"
,
"translation"
:
"%s, Zentao version '%s'.
\n
Please use above OpenSource 17.0, Biz 7.0, Max 3.1 version, or you may install RestAPI plugin according to UserManual section 4.4."
},
{
"id"
:
"jacoco_report"
,
"translation"
:
"Jacoco Coverage Report"
}
]
}
res/server/zh/messages.json
浏览文件 @
3bc9a913
...
...
@@ -714,6 +714,10 @@
{
"id"
:
"pls_check_zentao_url"
,
"translation"
:
"%s,当前禅道版本'%s'。
\n
请确认您使用了禅道开源17.0、企业7.0、旗舰3.1以上版本,或已按照用户手册4.4小节成功安装RestAPI插件。"
},
{
"id"
:
"jacoco_report"
,
"translation"
:
"Jacoco覆盖率报告"
}
]
}
xdoc/jacoco/jacoco.xml
0 → 100644
浏览文件 @
3bc9a913
<report
name=
"ci_test_jcoco"
>
<sessioninfo
id=
"MacBook-Pro.local-326fb78a"
start=
"1682494760900"
dump=
"1682494762314"
/>
<package
name=
"com/deeptest/sample/jcoco"
>
<class
name=
"com/deeptest/sample/jcoco/Count"
sourcefilename=
"Count.java"
>
<method
name=
"<init>"
desc=
"()V"
line=
"3"
>
<counter
type=
"INSTRUCTION"
missed=
"0"
covered=
"3"
/>
<counter
type=
"LINE"
missed=
"0"
covered=
"1"
/>
<counter
type=
"COMPLEXITY"
missed=
"0"
covered=
"1"
/>
<counter
type=
"METHOD"
missed=
"0"
covered=
"1"
/>
</method>
<method
name=
"add"
desc=
"(II)I"
line=
"5"
>
<counter
type=
"INSTRUCTION"
missed=
"1"
covered=
"10"
/>
<counter
type=
"BRANCH"
missed=
"1"
covered=
"1"
/>
<counter
type=
"LINE"
missed=
"1"
covered=
"4"
/>
<counter
type=
"COMPLEXITY"
missed=
"1"
covered=
"1"
/>
<counter
type=
"METHOD"
missed=
"0"
covered=
"1"
/>
</method>
<method
name=
"sub"
desc=
"(II)I"
line=
"16"
>
<counter
type=
"INSTRUCTION"
missed=
"4"
covered=
"0"
/>
<counter
type=
"LINE"
missed=
"1"
covered=
"0"
/>
<counter
type=
"COMPLEXITY"
missed=
"1"
covered=
"0"
/>
<counter
type=
"METHOD"
missed=
"1"
covered=
"0"
/>
</method>
<method
name=
"div"
desc=
"(II)I"
line=
"20"
>
<counter
type=
"INSTRUCTION"
missed=
"4"
covered=
"0"
/>
<counter
type=
"LINE"
missed=
"1"
covered=
"0"
/>
<counter
type=
"COMPLEXITY"
missed=
"1"
covered=
"0"
/>
<counter
type=
"METHOD"
missed=
"1"
covered=
"0"
/>
</method>
<counter
type=
"INSTRUCTION"
missed=
"9"
covered=
"13"
/>
<counter
type=
"BRANCH"
missed=
"1"
covered=
"1"
/>
<counter
type=
"LINE"
missed=
"3"
covered=
"5"
/>
<counter
type=
"COMPLEXITY"
missed=
"3"
covered=
"2"
/>
<counter
type=
"METHOD"
missed=
"2"
covered=
"2"
/>
<counter
type=
"CLASS"
missed=
"0"
covered=
"1"
/>
</class>
<sourcefile
name=
"Count.java"
>
<line
nr=
"3"
mi=
"0"
ci=
"3"
mb=
"0"
cb=
"0"
/>
<line
nr=
"5"
mi=
"0"
ci=
"2"
mb=
"0"
cb=
"0"
/>
<line
nr=
"6"
mi=
"0"
ci=
"2"
mb=
"1"
cb=
"1"
/>
<line
nr=
"7"
mi=
"0"
ci=
"2"
mb=
"0"
cb=
"0"
/>
<line
nr=
"9"
mi=
"1"
ci=
"0"
mb=
"0"
cb=
"0"
/>
<line
nr=
"12"
mi=
"0"
ci=
"4"
mb=
"0"
cb=
"0"
/>
<line
nr=
"16"
mi=
"4"
ci=
"0"
mb=
"0"
cb=
"0"
/>
<line
nr=
"20"
mi=
"4"
ci=
"0"
mb=
"0"
cb=
"0"
/>
<counter
type=
"INSTRUCTION"
missed=
"9"
covered=
"13"
/>
<counter
type=
"BRANCH"
missed=
"1"
covered=
"1"
/>
<counter
type=
"LINE"
missed=
"3"
covered=
"5"
/>
<counter
type=
"COMPLEXITY"
missed=
"3"
covered=
"2"
/>
<counter
type=
"METHOD"
missed=
"2"
covered=
"2"
/>
<counter
type=
"CLASS"
missed=
"0"
covered=
"1"
/>
</sourcefile>
<counter
type=
"INSTRUCTION"
missed=
"9"
covered=
"13"
/>
<counter
type=
"BRANCH"
missed=
"1"
covered=
"1"
/>
<counter
type=
"LINE"
missed=
"3"
covered=
"5"
/>
<counter
type=
"COMPLEXITY"
missed=
"3"
covered=
"2"
/>
<counter
type=
"METHOD"
missed=
"2"
covered=
"2"
/>
<counter
type=
"CLASS"
missed=
"0"
covered=
"1"
/>
</package>
<counter
type=
"INSTRUCTION"
missed=
"9"
covered=
"13"
/>
<counter
type=
"BRANCH"
missed=
"1"
covered=
"1"
/>
<counter
type=
"LINE"
missed=
"3"
covered=
"5"
/>
<counter
type=
"COMPLEXITY"
missed=
"3"
covered=
"2"
/>
<counter
type=
"METHOD"
missed=
"2"
covered=
"2"
/>
<counter
type=
"CLASS"
missed=
"0"
covered=
"1"
/>
</report>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录