Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
e3aa9fe3
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,发现更多精彩内容 >>
提交
e3aa9fe3
编写于
1月 05, 2021
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support cyrpress test framework
上级
8385cfd6
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
93 addition
and
8 deletion
+93
-8
src/model/testing.go
src/model/testing.go
+38
-0
src/service/testing/unitTestResult.go
src/service/testing/unitTestResult.go
+47
-1
src/utils/const/const.go
src/utils/const/const.go
+6
-5
src/ztf.go
src/ztf.go
+2
-2
未找到文件。
src/model/testing.go
浏览文件 @
e3aa9fe3
...
@@ -405,3 +405,41 @@ type RobotStatus struct {
...
@@ -405,3 +405,41 @@ type RobotStatus struct {
StartTime
string
`xml:"starttime,attr"`
StartTime
string
`xml:"starttime,attr"`
EndTime
string
`xml:"endtime,attr"`
EndTime
string
`xml:"endtime,attr"`
}
}
// cypress
var
CypressResults
=
"results"
type
CypressTestsuites
struct
{
XMLName
xml
.
Name
`xml:"testsuites"`
Text
string
`xml:",chardata"`
Name
string
`xml:"name,attr"`
Time
string
`xml:"time,attr"`
Tests
string
`xml:"tests,attr"`
Failures
string
`xml:"failures,attr"`
Testsuites
[]
CypressTestsuite
`xml:"testsuite"`
}
type
CypressTestsuite
struct
{
Text
string
`xml:",chardata"`
Name
string
`xml:"name,attr"`
Timestamp
string
`xml:"timestamp,attr"`
Tests
string
`xml:"tests,attr"`
File
string
`xml:"file,attr"`
Time
float64
`xml:"time,attr"`
Failures
string
`xml:"failures,attr"`
Testcases
[]
CypressTestcase
`xml:"testcase"`
}
type
CypressTestcase
struct
{
Text
string
`xml:",chardata"`
Name
string
`xml:"name,attr"`
Time
float64
`xml:"time,attr"`
Classname
string
`xml:"classname,attr"`
Failures
[]
CypressFailure
`xml:"failure"`
}
type
CypressFailure
struct
{
Text
string
`xml:",chardata"`
Message
string
`xml:"message,attr"`
Type
string
`xml:"type,attr"`
}
src/service/testing/unitTestResult.go
浏览文件 @
e3aa9fe3
...
@@ -22,7 +22,7 @@ func RetrieveUnitResult() (suites []model.UnitTestSuite, resultDir string) {
...
@@ -22,7 +22,7 @@ func RetrieveUnitResult() (suites []model.UnitTestSuite, resultDir string) {
resultDir
=
fmt
.
Sprintf
(
"target%ssurefire-reports%s"
,
constant
.
PthSep
,
constant
.
PthSep
)
resultDir
=
fmt
.
Sprintf
(
"target%ssurefire-reports%s"
,
constant
.
PthSep
,
constant
.
PthSep
)
}
else
if
vari
.
UnitTestType
==
constant
.
UnitTestTypeTestNG
&&
vari
.
UnitTestTool
==
constant
.
UnitTestToolMvn
{
}
else
if
vari
.
UnitTestType
==
constant
.
UnitTestTypeTestNG
&&
vari
.
UnitTestTool
==
constant
.
UnitTestToolMvn
{
resultDir
=
fmt
.
Sprintf
(
"target%ssurefire-reports%sjunitreports"
,
constant
.
PthSep
,
constant
.
PthSep
)
resultDir
=
fmt
.
Sprintf
(
"target%ssurefire-reports%sjunitreports"
,
constant
.
PthSep
,
constant
.
PthSep
)
}
else
if
vari
.
UnitTestType
==
constant
.
UnitTestTypeRobot
{
}
else
if
vari
.
UnitTestType
==
constant
.
UnitTestTypeRobot
||
vari
.
UnitTestType
==
constant
.
UnitTestTypeCypress
{
resultDir
=
vari
.
UnitTestResults
resultDir
=
vari
.
UnitTestResults
}
else
{
}
else
{
resultDir
=
vari
.
UnitTestResult
resultDir
=
vari
.
UnitTestResult
...
@@ -103,6 +103,12 @@ func RetrieveUnitResult() (suites []model.UnitTestSuite, resultDir string) {
...
@@ -103,6 +103,12 @@ func RetrieveUnitResult() (suites []model.UnitTestSuite, resultDir string) {
if
err
==
nil
{
if
err
==
nil
{
testSuite
=
ConvertRobotResult
(
robotResult
)
testSuite
=
ConvertRobotResult
(
robotResult
)
}
}
}
else
if
vari
.
UnitTestType
==
"cypress"
{
cyResult
:=
model
.
CypressTestsuites
{}
err
=
xml
.
Unmarshal
([]
byte
(
content
),
&
cyResult
)
if
err
==
nil
{
testSuite
=
ConvertCyResult
(
cyResult
)
}
}
}
if
err
==
nil
{
if
err
==
nil
{
...
@@ -373,3 +379,43 @@ func RetrieveRobotTests(suite model.RobotSuite, tests *[]model.RobotTest) {
...
@@ -373,3 +379,43 @@ func RetrieveRobotTests(suite model.RobotSuite, tests *[]model.RobotTest) {
*
tests
=
append
(
*
tests
,
test
)
*
tests
=
append
(
*
tests
,
test
)
}
}
}
}
func
ConvertCyResult
(
result
model
.
CypressTestsuites
)
model
.
UnitTestSuite
{
testSuite
:=
model
.
UnitTestSuite
{}
for
_
,
suite
:=
range
result
.
Testsuites
{
if
suite
.
Name
==
"Root Suite"
{
continue
}
templ
:=
"20060102 15:04:05.000"
duration
:=
suite
.
Time
startTime
,
_
:=
time
.
ParseInLocation
(
templ
,
suite
.
Timestamp
,
time
.
Local
)
//endTime := time.Unix(startTime.Unix() + int64(duration), 0)
testSuite
.
Duration
=
int64
(
duration
)
testSuite
.
Time
=
float32
(
startTime
.
Unix
())
for
_
,
cs
:=
range
suite
.
Testcases
{
caseResult
:=
model
.
UnitResult
{}
caseResult
.
TestSuite
=
suite
.
Name
caseResult
.
Title
=
cs
.
Name
caseResult
.
Duration
=
float32
(
cs
.
Time
)
if
len
(
cs
.
Failures
)
>
0
{
caseResult
.
Status
=
"fail"
fail
:=
model
.
Failure
{}
fail
.
Type
=
cs
.
Failures
[
0
]
.
Type
fail
.
Desc
=
cs
.
Failures
[
0
]
.
Message
caseResult
.
Failure
=
&
fail
}
else
{
caseResult
.
Status
=
"pass"
}
testSuite
.
TestCases
=
append
(
testSuite
.
TestCases
,
caseResult
)
}
}
return
testSuite
}
src/utils/const/const.go
浏览文件 @
e3aa9fe3
...
@@ -45,7 +45,8 @@ var (
...
@@ -45,7 +45,8 @@ var (
UnitTestTypeJunit
=
"junit"
UnitTestTypeJunit
=
"junit"
UnitTestTypeTestNG
=
"testng"
UnitTestTypeTestNG
=
"testng"
UnitTestTypeRobot
=
"robot"
UnitTestTypeRobot
=
"robot"
UnitTestTypes
=
[]
string
{
UnitTestTypeJunit
,
UnitTestTypeTestNG
,
UnitTestTypeRobot
,
UnitTestTypeCypress
=
"cypress"
UnitTestTypes
=
[]
string
{
UnitTestTypeJunit
,
UnitTestTypeTestNG
,
UnitTestTypeRobot
,
UnitTestTypeCypress
,
"phpunit"
,
"pytest"
,
"jest"
,
"cppunit"
,
"gtest"
,
"qtest"
}
"phpunit"
,
"pytest"
,
"jest"
,
"cppunit"
,
"gtest"
,
"qtest"
}
UnitTestToolMvn
=
"mvn"
UnitTestToolMvn
=
"mvn"
UnitTestToolRobot
=
"robot"
UnitTestToolRobot
=
"robot"
...
...
src/ztf.go
浏览文件 @
e3aa9fe3
...
@@ -74,8 +74,8 @@ func main() {
...
@@ -74,8 +74,8 @@ func main() {
flagSet
.
BoolVar
(
&
noNeedConfirm
,
"y"
,
false
,
""
)
flagSet
.
BoolVar
(
&
noNeedConfirm
,
"y"
,
false
,
""
)
flagSet
.
BoolVar
(
&
vari
.
Verbose
,
"verbose"
,
false
,
""
)
flagSet
.
BoolVar
(
&
vari
.
Verbose
,
"verbose"
,
false
,
""
)
flagSet
.
IntVar
(
&
vari
.
Port
,
"P"
,
8848
,
""
)
flagSet
.
IntVar
(
&
vari
.
Port
,
"P"
,
0
,
""
)
flagSet
.
IntVar
(
&
vari
.
Port
,
"port"
,
8848
,
""
)
flagSet
.
IntVar
(
&
vari
.
Port
,
"port"
,
0
,
""
)
flagSet
.
StringVar
(
&
vari
.
Platform
,
"M"
,
string
(
serverConst
.
Vm
),
""
)
flagSet
.
StringVar
(
&
vari
.
Platform
,
"M"
,
string
(
serverConst
.
Vm
),
""
)
var
placeholder
string
var
placeholder
string
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录