Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
8367defc
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,发现更多精彩内容 >>
提交
8367defc
编写于
7月 31, 2019
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
run test script/suite and show results
上级
d239da51
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
23 deletion
+16
-23
src/biz/check.go
src/biz/check.go
+2
-4
src/biz/exe.go
src/biz/exe.go
+5
-10
src/biz/log.go
src/biz/log.go
+2
-2
src/biz/report.go
src/biz/report.go
+3
-3
src/script/display.go
src/script/display.go
+2
-2
src/utils/file.go
src/utils/file.go
+2
-2
未找到文件。
src/biz/check.go
浏览文件 @
8367defc
package
biz
import
(
"fmt"
"github.com/easysoft/zentaoatf/src/misc"
"github.com/easysoft/zentaoatf/src/model"
"github.com/easysoft/zentaoatf/src/utils"
...
...
@@ -10,8 +9,8 @@ import (
)
func
CheckResults
(
files
[]
string
,
dir
string
,
langType
string
,
report
*
model
.
TestReport
)
{
fmt
.
Println
(
"
\n
"
)
PrintWholeLine
(
utils
.
I118Prt
.
Sprintf
(
"begin_analyse"
),
"="
,
color
.
Fg
Blue
)
Printt
(
"
\n
"
)
PrintWholeLine
(
utils
.
I118Prt
.
Sprintf
(
"begin_analyse"
),
"="
,
color
.
Fg
Cyan
)
for
_
,
scriptFile
:=
range
files
{
logFile
:=
utils
.
ScriptToLogName
(
dir
,
scriptFile
)
...
...
@@ -73,7 +72,6 @@ func ValidateTestCase(scriptFile string, langType string,
}
func
ValidateStep
(
langType
string
,
expectLines
[]
string
,
actualLines
[]
string
)
(
bool
,
[]
model
.
CheckPointLog
)
{
stepResult
:=
true
checkpointLogs
:=
make
([]
model
.
CheckPointLog
,
0
)
...
...
src/biz/exe.go
浏览文件 @
8367defc
package
biz
import
(
"fmt"
"github.com/easysoft/zentaoatf/src/misc"
"github.com/easysoft/zentaoatf/src/model"
"github.com/easysoft/zentaoatf/src/utils"
...
...
@@ -11,7 +10,7 @@ import (
)
func
ExeScripts
(
files
[]
string
,
dir
string
,
langType
string
,
report
*
model
.
TestReport
)
{
PrintWholeLine
(
utils
.
I118Prt
.
Sprintf
(
"start_execution"
,
""
),
"="
,
color
.
Fg
Blue
)
PrintWholeLine
(
utils
.
I118Prt
.
Sprintf
(
"start_execution"
,
""
),
"="
,
color
.
Fg
Cyan
)
startTime
:=
time
.
Now
()
.
Unix
()
report
.
StartTime
=
startTime
...
...
@@ -20,7 +19,7 @@ func ExeScripts(files []string, dir string, langType string, report *model.TestR
ExeScript
(
file
,
langType
,
dir
)
}
PrintWholeLine
(
utils
.
I118Prt
.
Sprintf
(
"end_execution"
,
""
),
"="
,
color
.
Fg
Blue
)
PrintWholeLine
(
utils
.
I118Prt
.
Sprintf
(
"end_execution"
,
""
),
"="
,
color
.
Fg
Cyan
)
endTime
:=
time
.
Now
()
.
Unix
()
secs
:=
endTime
-
startTime
...
...
@@ -44,22 +43,18 @@ func ExeScript(file string, langType string, dir string) {
startTime
:=
time
.
Now
()
fmt
.
Println
(
""
)
msg
:=
utils
.
I118Prt
.
Sprintf
(
"start_case"
,
file
,
startTime
.
Format
(
"2006-01-02 15:04:05"
))
PrintWholeLine
(
msg
,
"-"
,
color
.
FgCyan
)
//fmt.Println("")
output
:=
utils
.
ExecCommand
(
command
)
utils
.
WriteFile
(
logFile
,
strings
.
Join
(
output
,
""
))
Printt
(
strings
.
Join
(
output
,
""
))
if
utils
.
RunFromCui
{
Printt
(
strings
.
Join
(
output
,
""
))
}
entTime
:=
time
.
Now
()
secs
:=
int64
(
entTime
.
Sub
(
startTime
)
/
time
.
Second
)
msg
=
utils
.
I118Prt
.
Sprintf
(
"end_case"
,
file
,
entTime
.
Format
(
"2006-01-02 15:04:05"
),
secs
)
PrintWholeLine
(
msg
,
"-"
,
color
.
FgCyan
)
//fmt.Println("")
}
src/biz/log.go
浏览文件 @
8367defc
...
...
@@ -14,7 +14,7 @@ func PrintWholeLine(msg string, char string, attr color.Attribute) {
var
postfixLen
int
if
utils
.
RunFromCui
{
maxX
,
_
:=
utils
.
Cui
.
Size
()
postfixLen
=
maxX
-
utils
.
LeftWidth
-
utf8
.
RuneCountInString
(
msg
)
-
8
postfixLen
=
maxX
-
utils
.
LeftWidth
-
utf8
.
RuneCountInString
(
msg
)
-
9
}
else
{
postfixLen
=
utils
.
Prefer
.
Width
-
utf8
.
RuneCountInString
(
msg
)
-
6
if
postfixLen
<
0
{
// no width in debug mode
...
...
@@ -71,7 +71,7 @@ func Printt(str string) {
output
=
color
.
Output
}
fmt
.
Fprintf
(
output
,
str
+
"
\n
"
)
fmt
.
Fprintf
(
output
,
str
)
}
func
coloredStatus
(
status
string
)
string
{
...
...
src/biz/report.go
浏览文件 @
8367defc
...
...
@@ -26,7 +26,7 @@ func Print(report model.TestReport, workDir string) {
PrintAndLogColorLn
(
&
logs
,
fmt
.
Sprintf
(
" %s: %d"
,
utils
.
I118Prt
.
Sprintf
(
"skip"
),
report
.
Skip
),
color
.
FgYellow
)
for
_
,
cs
:=
range
report
.
Cases
{
str
:=
"
\n
%s %s "
str
:=
"
\n
%s %s
\n
"
status
:=
cs
.
Status
.
String
()
statusColor
:=
coloredStatus
(
status
)
...
...
@@ -55,9 +55,9 @@ func Print(report model.TestReport, workDir string) {
cpStatus
:=
utils
.
BoolToPass
(
step
.
Status
)
cpStatusColored
:=
coloredStatus
(
cpStatus
)
logs
=
append
(
logs
,
fmt
.
Sprintf
(
" %s%d: %s"
,
utils
.
I118Prt
.
Sprintf
(
"checkpoint"
),
cp
.
Numb
,
logs
=
append
(
logs
,
fmt
.
Sprintf
(
" %s%d: %s
\n
"
,
utils
.
I118Prt
.
Sprintf
(
"checkpoint"
),
cp
.
Numb
,
utils
.
BoolToPass
(
cp
.
Status
)))
Printt
(
fmt
.
Sprintf
(
" %s%d: %s"
,
utils
.
I118Prt
.
Sprintf
(
"checkpoint"
),
cp
.
Numb
,
cpStatusColored
))
Printt
(
fmt
.
Sprintf
(
" %s%d: %s
\n
"
,
utils
.
I118Prt
.
Sprintf
(
"checkpoint"
),
cp
.
Numb
,
cpStatusColored
))
PrintAndLog
(
&
logs
,
fmt
.
Sprintf
(
" %s %s"
,
utils
.
I118Prt
.
Sprintf
(
"expect_result"
),
cp
.
Expect
))
PrintAndLog
(
&
logs
,
fmt
.
Sprintf
(
" %s %s"
,
utils
.
I118Prt
.
Sprintf
(
"actual_result"
),
cp
.
Actual
))
...
...
src/script/display.go
浏览文件 @
8367defc
...
...
@@ -10,7 +10,7 @@ import (
func
Summary
(
file
string
)
{
content
:=
utils
.
ReadFile
(
file
)
myExp
:=
regexp
.
MustCompile
(
`<<
<
TC[\S\s]*caseId:([^\n]*)\n+title:([^\n]*)\n`
)
myExp
:=
regexp
.
MustCompile
(
`<<TC[\S\s]*caseId:([^\n]*)\n+title:([^\n]*)\n`
)
arr
:=
myExp
.
FindStringSubmatch
(
content
)
if
len
(
arr
)
>
2
{
...
...
@@ -25,7 +25,7 @@ func Detail(file string) {
content
:=
utils
.
ReadFile
(
file
)
myExp
:=
regexp
.
MustCompile
(
`<<
<
TC[\S\s]*caseId:([^\n]*)\n+title:([^\n]*)\n+steps:([\S\s]*)\n+expects:([\S\s]*?)\n+(readme:|TC;)`
)
`<<TC[\S\s]*caseId:([^\n]*)\n+title:([^\n]*)\n+steps:([\S\s]*)\n+expects:([\S\s]*?)\n+(readme:|TC;)`
)
arr
:=
myExp
.
FindStringSubmatch
(
content
)
if
len
(
arr
)
>
2
{
...
...
src/utils/file.go
浏览文件 @
8367defc
...
...
@@ -174,7 +174,7 @@ func MkDirIfNeeded(dir string) {
func
ReadCheckpointSteps
(
file
string
)
[]
string
{
content
:=
ReadFile
(
file
)
myExp
:=
regexp
.
MustCompile
(
`<<
<
TC[\S\s]*steps:[^\n]*\n*([\S\s]*)\n+expects:`
)
myExp
:=
regexp
.
MustCompile
(
`<<TC[\S\s]*steps:[^\n]*\n*([\S\s]*)\n+expects:`
)
arr
:=
myExp
.
FindStringSubmatch
(
content
)
str
:=
""
...
...
@@ -191,7 +191,7 @@ func ReadCheckpointSteps(file string) []string {
func
ReadExpect
(
file
string
)
[][]
string
{
content
:=
ReadFile
(
file
)
myExp
:=
regexp
.
MustCompile
(
`<<
<TC[\S\s]*expects:[^\n]*\n*
([\S\s]*?)(readme:|TC;)`
)
myExp
:=
regexp
.
MustCompile
(
`<<
TC[\S\s]*expects:[^\n]*\n+
([\S\s]*?)(readme:|TC;)`
)
arr
:=
myExp
.
FindStringSubmatch
(
content
)
str
:=
""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录