Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
07f34cec
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
9 个月 前同步成功
通知
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 搜索 >>
提交
07f34cec
编写于
9月 02, 2019
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test on win7
上级
dbed31bf
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
71 addition
and
28 deletion
+71
-28
res/messages_en.json
res/messages_en.json
+6
-0
res/messages_zh.json
res/messages_zh.json
+5
-0
res/res.go
res/res.go
+6
-6
scripts-demo/tc-01.bat
scripts-demo/tc-01.bat
+1
-1
scripts-demo/tc-01.sh
scripts-demo/tc-01.sh
+1
-1
src/action/run.go
src/action/run.go
+13
-0
src/atf.go
src/atf.go
+12
-12
src/service/script/assert.go
src/service/script/assert.go
+13
-0
src/utils/file/file.go
src/utils/file/file.go
+5
-5
src/utils/lang/lang.go
src/utils/lang/lang.go
+6
-0
src/utils/stdin/stdin.go
src/utils/stdin/stdin.go
+1
-1
xdoc/scripts/bat/tc-001.bat
xdoc/scripts/bat/tc-001.bat
+1
-1
xdoc/scripts/shell/tc-001.sh
xdoc/scripts/shell/tc-001.sh
+1
-1
未找到文件。
res/messages_en.json
浏览文件 @
07f34cec
...
...
@@ -145,11 +145,17 @@
"message"
:
"only en(%s) and zh(%s) language is acceptable"
,
"translation"
:
"only en(%s) and zh(%s) language is acceptable"
},
{
"id"
:
"run_sets_with_no_dir"
,
"message"
:
""
,
"translation"
:
"To run suite or task, the first param should be a dir that contains scripts"
},
{
"id"
:
"no_cases"
,
"message"
:
"No test cases found"
,
"translation"
:
"No test cases found"
},
{
"id"
:
"no_scripts"
,
"message"
:
"No test scripts found"
,
...
...
res/messages_zh.json
浏览文件 @
07f34cec
...
...
@@ -133,6 +133,11 @@
"message"
:
"只支持语言en(%s)和zh(%s)"
,
"translation"
:
"只支持语言en(%s)和zh(%s)"
},
{
"id"
:
"run_sets_with_no_dir"
,
"message"
:
""
,
"translation"
:
"执行套件或任务时,第一个参数必须为包含脚本的目录"
},
{
"id"
:
"no_cases"
,
"message"
:
"No test cases found"
,
...
...
res/res.go
浏览文件 @
07f34cec
此差异已折叠。
点击以展开。
scripts-demo/tc-01.bat
浏览文件 @
07f34cec
goto
start
<<<
TC
caseId
:
1
caseId
:
-
1
productId
:
0
title
:
Test
network
connection
steps
:
steps
that
begin
with
@
are
checkpoints
...
...
scripts-demo/tc-01.sh
浏览文件 @
07f34cec
...
...
@@ -2,7 +2,7 @@
:<<
!
<<<
TC
caseId: 1
caseId:
-
1
productId: 0
title: Test network connection
steps: steps that begin with @ are checkpoints
...
...
src/action/run.go
浏览文件 @
07f34cec
...
...
@@ -24,6 +24,19 @@ func Run(files []string, suiteIdStr string, taskIdStr string) {
vari
.
WorkDir
=
fileUtils
.
AbosutePath
(
"."
)
vari
.
RunDir
=
zentaoUtils
.
RunDateFolder
()
if
(
suiteIdStr
!=
""
||
taskIdStr
!=
""
)
&&
len
(
files
)
==
0
{
// run with suite/task id, but no dir, get scripts from .
files
=
append
(
files
,
fileUtils
.
AbosutePath
(
"."
))
}
else
if
(
len
(
files
)
>
0
&&
path
.
Ext
(
files
[
0
])
==
"."
+
constant
.
ExtNameSuite
)
||
(
len
(
files
)
>
0
&&
path
.
Ext
(
files
[
0
])
==
"."
+
constant
.
ExtNameResult
)
{
// only suite/result file provided
temp
:=
make
([]
string
,
0
)
temp
=
append
(
temp
,
fileUtils
.
AbosutePath
(
path
.
Dir
(
files
[
0
])))
temp
=
append
(
temp
,
files
[
0
])
files
=
temp
}
if
suiteIdStr
!=
""
{
suiteId
,
err
:=
strconv
.
Atoi
(
suiteIdStr
)
if
err
==
nil
&&
suiteId
>
0
{
...
...
src/atf.go
浏览文件 @
07f34cec
...
...
@@ -62,8 +62,8 @@ func main() {
switch
os
.
Args
[
1
]
{
case
"run"
,
"-r"
:
files
,
idx
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
idx
+
1
:
]);
err
==
nil
{
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
len
(
files
)
+
2
:
]);
err
==
nil
{
action
.
Run
(
files
,
suiteId
,
taskId
)
}
...
...
@@ -78,32 +78,32 @@ func main() {
}
case
"ci"
:
files
,
idx
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
idx
+
1
:
]);
err
==
nil
{
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
len
(
files
)
+
2
:
]);
err
==
nil
{
action
.
CommitCases
(
files
)
}
case
"cr"
:
files
,
idx
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
idx
+
1
:
]);
err
==
nil
{
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
len
(
files
)
+
2
:
]);
err
==
nil
{
action
.
CommitResult
(
files
)
}
case
"cb"
:
files
,
idx
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
idx
+
1
:
]);
err
==
nil
{
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
len
(
files
)
+
2
:
]);
err
==
nil
{
action
.
CommitBug
(
files
)
}
case
"list"
,
"ls"
,
"-l"
:
files
,
idx
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
idx
+
1
:
]);
err
==
nil
{
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
len
(
files
)
+
2
:
]);
err
==
nil
{
action
.
List
(
files
,
keywords
)
}
case
"view"
,
"-v"
:
files
,
idx
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
idx
+
1
:
]);
err
==
nil
{
files
:=
fileUtils
.
GetFilesFromParams
(
os
.
Args
[
2
:
])
if
err
:=
flagSet
.
Parse
(
os
.
Args
[
len
(
files
)
+
2
:
]);
err
==
nil
{
action
.
View
(
files
,
keywords
)
}
...
...
src/service/script/assert.go
浏览文件 @
07f34cec
...
...
@@ -7,6 +7,7 @@ import (
commonUtils
"github.com/easysoft/zentaoatf/src/utils/common"
constant
"github.com/easysoft/zentaoatf/src/utils/const"
"github.com/easysoft/zentaoatf/src/utils/file"
langUtils
"github.com/easysoft/zentaoatf/src/utils/lang"
zentaoUtils
"github.com/easysoft/zentaoatf/src/utils/zentao"
"io/ioutil"
"os"
...
...
@@ -118,6 +119,11 @@ func GetScriptByIdsInDir(dirPth string, idMap map[int]string, files *[]string) e
sep
:=
string
(
os
.
PathSeparator
)
name
:=
path
.
Base
(
dirPth
)
if
strings
.
Index
(
name
,
"."
)
==
0
||
name
==
"bin"
||
name
==
"release"
||
name
==
"logs"
||
name
==
"xdoc"
{
return
nil
}
dir
,
err
:=
ioutil
.
ReadDir
(
dirPth
)
if
err
!=
nil
{
return
err
...
...
@@ -128,6 +134,13 @@ func GetScriptByIdsInDir(dirPth string, idMap map[int]string, files *[]string) e
if
fi
.
IsDir
()
{
// 目录, 递归遍历
GetScriptByIdsInDir
(
dirPth
+
name
+
sep
,
idMap
,
files
)
}
else
{
regx
:=
langUtils
.
GetSupportLangageRegx
()
pass
,
_
:=
regexp
.
MatchString
(
"^*.
\\
."
+
regx
+
"$"
,
name
)
if
!
pass
{
continue
}
path
:=
dirPth
+
name
if
CheckFileIsScript
(
path
)
{
id
,
_
,
_
:=
zentaoUtils
.
GetCaseInfo
(
path
)
...
...
src/utils/file/file.go
浏览文件 @
07f34cec
...
...
@@ -81,11 +81,10 @@ func UpdateDir(path string) string {
return
path
}
func
GetFilesFromParams
(
arguments
[]
string
)
([]
string
,
int
)
{
func
GetFilesFromParams
(
arguments
[]
string
)
[]
string
{
ret
:=
make
([]
string
,
0
)
index
:=
-
1
for
idx
,
arg
:=
range
arguments
{
for
_
,
arg
:=
range
arguments
{
if
strings
.
Index
(
arg
,
"-"
)
!=
0
{
if
arg
==
"."
{
arg
=
AbosutePath
(
"."
)
...
...
@@ -96,9 +95,10 @@ func GetFilesFromParams(arguments []string) ([]string, int) {
}
ret
=
append
(
ret
,
arg
)
index
=
idx
}
else
{
break
}
}
return
ret
,
index
return
ret
}
src/utils/lang/lang.go
浏览文件 @
07f34cec
...
...
@@ -88,6 +88,12 @@ func CheckSupportLangages(scriptLang string) bool {
return
true
}
func
GetSupportLangageRegx
()
string
{
regx
:=
"("
+
strings
.
Join
(
GetSupportLangageArr
(),
"|"
)
+
")"
return
regx
}
func
init
()
{
GetSupportedScriptLang
()
}
src/utils/stdin/stdin.go
浏览文件 @
07f34cec
...
...
@@ -102,7 +102,7 @@ func InputForCheckout(productId *string, moduleId *string, suiteId *string, task
*
independentFile
=
false
}
regx
:=
"("
+
strings
.
Join
(
langUtils
.
GetSupportLangageArr
(),
"|"
)
+
")"
regx
:=
langUtils
.
GetSupportLangageRegx
()
fmtParam
:=
strings
.
Join
(
langUtils
.
GetSupportLangageArr
(),
" / "
)
*
scriptLang
=
getInput
(
regx
,
"enter_co_language"
,
fmtParam
)
...
...
xdoc/scripts/bat/tc-001.bat
浏览文件 @
07f34cec
goto
start
<<<
TC
caseId
:
1
caseId
:
-
1
caseIdInTask
:
0
taskId
:
0
title
: 测试服务器响应时间
...
...
xdoc/scripts/shell/tc-001.sh
浏览文件 @
07f34cec
...
...
@@ -2,7 +2,7 @@
:<<
!
<<<
TC
caseId: 1
caseId:
-
1
caseIdInTask: 0
taskId: 0
title: 测试服务器响应时间
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录