Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
f85103c1
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,发现更多精彩内容 >>
提交
f85103c1
编写于
8月 14, 2019
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
submit test results to zendao server
上级
2ec6d995
变更
14
显示空白变更内容
内联
并排
Showing
14 changed file
with
162 addition
and
82 deletion
+162
-82
src/model/test.go
src/model/test.go
+9
-5
src/service/client/http.go
src/service/client/http.go
+39
-3
src/service/script/result.go
src/service/script/result.go
+5
-5
src/service/testing/check.go
src/service/testing/check.go
+6
-6
src/service/testing/report.go
src/service/testing/report.go
+5
-1
src/service/testing/request.go
src/service/testing/request.go
+5
-9
src/service/testing/result.go
src/service/testing/result.go
+59
-39
src/service/zentao/account.go
src/service/zentao/account.go
+1
-1
src/service/zentao/testcase.go
src/service/zentao/testcase.go
+1
-1
src/test.go
src/test.go
+0
-5
src/test/submitResult.go
src/test/submitResult.go
+11
-0
src/ui/pageTestResult.go
src/ui/pageTestResult.go
+2
-4
src/utils/const/enum.go
src/utils/const/enum.go
+7
-3
src/utils/print/print.go
src/utils/print/print.go
+12
-0
未找到文件。
src/model/test.go
浏览文件 @
f85103c1
package
model
package
model
import
(
"github.com/easysoft/zentaoatf/src/utils/const"
)
type
Product
struct
{
type
Product
struct
{
Id
int
Id
int
Code
string
Code
string
...
@@ -66,7 +62,7 @@ type CaseLog struct {
...
@@ -66,7 +62,7 @@ type CaseLog struct {
Id
int
Id
int
IdInTask
int
IdInTask
int
Path
string
Path
string
Status
constant
.
ResultStatus
Status
string
Steps
[]
StepLog
Steps
[]
StepLog
}
}
...
@@ -83,3 +79,11 @@ type CheckPointLog struct {
...
@@ -83,3 +79,11 @@ type CheckPointLog struct {
Actual
string
Actual
string
Status
bool
Status
bool
}
}
type
CaseResult
struct
{
Case
string
Version
string
Steps
map
[
string
]
string
Reals
map
[
string
]
string
}
src/service/client/http.go
浏览文件 @
f85103c1
...
@@ -47,11 +47,47 @@ func Get(url string, params map[string]string) (string, bool) {
...
@@ -47,11 +47,47 @@ func Get(url string, params map[string]string) (string, bool) {
return
string
(
bodyStr
),
true
return
string
(
bodyStr
),
true
}
else
{
// 嵌套结构
}
else
{
// 嵌套结构
dataStr
:=
bodyJson
.
Data
dataStr
:=
bodyJson
.
Data
return
dataStr
,
status
==
"
succe
ss"
return
dataStr
,
status
==
"
pa
ss"
}
}
}
}
func
Post
(
url
string
,
params
map
[
string
]
string
)
(
string
,
bool
)
{
func
PostJson
(
url
string
,
params
map
[
string
]
interface
{})
(
string
,
bool
)
{
client
:=
&
http
.
Client
{}
bytesData
,
_
:=
json
.
Marshal
(
params
)
req
,
err
:=
http
.
NewRequest
(
"POST"
,
url
,
strings
.
NewReader
(
string
(
bytesData
)))
if
err
!=
nil
{
return
""
,
false
}
//req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req
.
Header
.
Set
(
"Content-Type"
,
"application/json;charset=UTF-8"
)
req
.
Header
.
Set
(
"cookie"
,
vari
.
SessionVar
+
"="
+
vari
.
SessionId
)
resp
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
return
""
,
false
}
bodyStr
,
_
:=
ioutil
.
ReadAll
(
resp
.
Body
)
println
(
string
(
bodyStr
))
var
bodyJson
model
.
ZentaoResponse
json
.
Unmarshal
(
bodyStr
,
&
bodyJson
)
defer
resp
.
Body
.
Close
()
status
:=
bodyJson
.
Status
if
status
==
""
{
// 非嵌套结构
return
string
(
bodyStr
),
true
}
else
{
// 嵌套结构
dataStr
:=
bodyJson
.
Data
return
dataStr
,
status
==
"pass"
}
}
func
PostStr
(
url
string
,
params
map
[
string
]
string
)
(
string
,
bool
)
{
client
:=
&
http
.
Client
{}
client
:=
&
http
.
Client
{}
paramStr
:=
""
paramStr
:=
""
...
@@ -90,6 +126,6 @@ func Post(url string, params map[string]string) (string, bool) {
...
@@ -90,6 +126,6 @@ func Post(url string, params map[string]string) (string, bool) {
return
string
(
bodyStr
),
true
return
string
(
bodyStr
),
true
}
else
{
// 嵌套结构
}
else
{
// 嵌套结构
dataStr
:=
bodyJson
.
Data
dataStr
:=
bodyJson
.
Data
return
dataStr
,
status
==
"
succe
ss"
return
dataStr
,
status
==
"
pa
ss"
}
}
}
}
src/service/script/result.go
浏览文件 @
f85103c1
...
@@ -37,9 +37,9 @@ func LoadTestResults(assert string) []string {
...
@@ -37,9 +37,9 @@ func LoadTestResults(assert string) []string {
return
ret
return
ret
}
}
func
GetTestResult
(
assert
string
,
date
string
)
[]
string
{
func
GetTestResult
ForDisplay
(
assert
string
,
date
string
)
[]
string
{
mode
,
name
:=
GetRunModeAndName
(
assert
)
mode
,
name
:=
GetRunModeAndName
(
assert
)
resultPath
:=
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
l
ogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
"result.txt"
resultPath
:=
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
L
ogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
"result.txt"
arr
:=
make
([]
string
,
0
)
arr
:=
make
([]
string
,
0
)
content
:=
fileUtils
.
ReadFile
(
resultPath
)
content
:=
fileUtils
.
ReadFile
(
resultPath
)
...
@@ -62,7 +62,7 @@ func GetTestResult(assert string, date string) []string {
...
@@ -62,7 +62,7 @@ func GetTestResult(assert string, date string) []string {
func
GetCheckpointsResult
(
assert
string
,
date
string
,
caseLine
string
)
string
{
func
GetCheckpointsResult
(
assert
string
,
date
string
,
caseLine
string
)
string
{
mode
,
name
:=
GetRunModeAndName
(
assert
)
mode
,
name
:=
GetRunModeAndName
(
assert
)
resultPath
:=
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
l
ogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
"result.txt"
resultPath
:=
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
L
ogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
"result.txt"
content
:=
fileUtils
.
ReadFile
(
resultPath
)
content
:=
fileUtils
.
ReadFile
(
resultPath
)
...
@@ -101,9 +101,9 @@ func GetLogFileByCase(assert string, date string, file string) string {
...
@@ -101,9 +101,9 @@ func GetLogFileByCase(assert string, date string, file string) string {
ext
:=
path
.
Ext
(
file
)
ext
:=
path
.
Ext
(
file
)
logName
:=
strings
.
Replace
(
commonUtils
.
Base
(
file
),
ext
,
".log"
,
-
1
)
logName
:=
strings
.
Replace
(
commonUtils
.
Base
(
file
),
ext
,
".log"
,
-
1
)
return
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
l
ogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
logName
return
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
L
ogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
logName
}
}
func
l
ogFolder
(
mode
string
,
name
string
,
date
string
)
string
{
func
L
ogFolder
(
mode
string
,
name
string
,
date
string
)
string
{
return
fmt
.
Sprintf
(
"%s-%s-%s"
,
mode
,
name
,
date
)
return
fmt
.
Sprintf
(
"%s-%s-%s"
,
mode
,
name
,
date
)
}
}
src/service/testing/check.go
浏览文件 @
f85103c1
...
@@ -34,10 +34,10 @@ func ValidateTestCase(scriptFile string, langType string,
...
@@ -34,10 +34,10 @@ func ValidateTestCase(scriptFile string, langType string,
caseId
,
caseIdInTask
:=
zentaoUtils
.
GetCaseIds
(
scriptFile
)
caseId
,
caseIdInTask
:=
zentaoUtils
.
GetCaseIds
(
scriptFile
)
stepLogs
:=
make
([]
model
.
StepLog
,
0
)
stepLogs
:=
make
([]
model
.
StepLog
,
0
)
caseResult
:=
constant
.
PASS
caseResult
:=
constant
.
PASS
.
String
()
if
skip
{
if
skip
{
caseResult
=
constant
.
SKIP
caseResult
=
constant
.
SKIP
.
String
()
}
else
{
}
else
{
indx
:=
0
indx
:=
0
for
_
,
step
:=
range
checkpointStepArr
{
// iterate by checkpoints
for
_
,
step
:=
range
checkpointStepArr
{
// iterate by checkpoints
...
@@ -62,18 +62,18 @@ func ValidateTestCase(scriptFile string, langType string,
...
@@ -62,18 +62,18 @@ func ValidateTestCase(scriptFile string, langType string,
stepLog
:=
model
.
StepLog
{
Id
:
stepId
,
Name
:
step
,
Status
:
stepResult
,
CheckPoints
:
checkpointLogs
}
stepLog
:=
model
.
StepLog
{
Id
:
stepId
,
Name
:
step
,
Status
:
stepResult
,
CheckPoints
:
checkpointLogs
}
stepLogs
=
append
(
stepLogs
,
stepLog
)
stepLogs
=
append
(
stepLogs
,
stepLog
)
if
!
stepResult
{
if
!
stepResult
{
caseResult
=
constant
.
FAIL
caseResult
=
constant
.
FAIL
.
String
()
}
}
indx
++
indx
++
}
}
}
}
if
caseResult
==
constant
.
FAIL
{
if
caseResult
==
constant
.
FAIL
.
String
()
{
report
.
Fail
=
report
.
Fail
+
1
report
.
Fail
=
report
.
Fail
+
1
}
else
if
caseResult
==
constant
.
PASS
{
}
else
if
caseResult
==
constant
.
PASS
.
String
()
{
report
.
Pass
=
report
.
Pass
+
1
report
.
Pass
=
report
.
Pass
+
1
}
else
if
caseResult
==
constant
.
SKIP
{
}
else
if
caseResult
==
constant
.
SKIP
.
String
()
{
report
.
Skip
=
report
.
Skip
+
1
report
.
Skip
=
report
.
Skip
+
1
}
}
report
.
Total
=
report
.
Total
+
1
report
.
Total
=
report
.
Total
+
1
...
...
src/service/testing/report.go
浏览文件 @
f85103c1
package
testingService
package
testingService
import
(
import
(
"encoding/json"
"fmt"
"fmt"
"github.com/easysoft/zentaoatf/src/model"
"github.com/easysoft/zentaoatf/src/model"
"github.com/easysoft/zentaoatf/src/utils/common"
"github.com/easysoft/zentaoatf/src/utils/common"
...
@@ -32,7 +33,7 @@ func Print(report model.TestReport, workDir string) {
...
@@ -32,7 +33,7 @@ func Print(report model.TestReport, workDir string) {
for
_
,
cs
:=
range
report
.
Cases
{
for
_
,
cs
:=
range
report
.
Cases
{
str
:=
"
\n
%s %d-%d: %s"
str
:=
"
\n
%s %d-%d: %s"
status
:=
cs
.
Status
.
String
()
status
:=
cs
.
Status
statusColor
:=
logUtils
.
ColoredStatus
(
status
)
statusColor
:=
logUtils
.
ColoredStatus
(
status
)
logs
=
append
(
logs
,
fmt
.
Sprintf
(
str
,
status
,
cs
.
Id
,
cs
.
IdInTask
,
cs
.
Path
))
logs
=
append
(
logs
,
fmt
.
Sprintf
(
str
,
status
,
cs
.
Id
,
cs
.
IdInTask
,
cs
.
Path
))
...
@@ -78,4 +79,7 @@ func Print(report model.TestReport, workDir string) {
...
@@ -78,4 +79,7 @@ func Print(report model.TestReport, workDir string) {
}
}
fileUtils
.
WriteFile
(
workDir
+
constant
.
LogDir
+
vari
.
RunDir
+
"result.txt"
,
strings
.
Join
(
logs
,
"
\n
"
))
fileUtils
.
WriteFile
(
workDir
+
constant
.
LogDir
+
vari
.
RunDir
+
"result.txt"
,
strings
.
Join
(
logs
,
"
\n
"
))
json
,
_
:=
json
.
Marshal
(
report
)
fileUtils
.
WriteFile
(
workDir
+
constant
.
LogDir
+
vari
.
RunDir
+
"result.json"
,
string
(
json
))
}
}
src/service/testing/request.go
浏览文件 @
f85103c1
package
testingService
package
testingService
import
(
import
(
httpClient
"github.com/easysoft/zentaoatf/src/service/client"
"github.com/easysoft/zentaoatf/src/utils/common"
config2
"github.com/easysoft/zentaoatf/src/utils/config"
config2
"github.com/easysoft/zentaoatf/src/utils/config"
constant
"github.com/easysoft/zentaoatf/src/utils/const"
print2
"github.com/easysoft/zentaoatf/src/utils/print"
)
)
func
GetZentaoSettings
()
{
func
GetZentaoSettings
()
{
...
@@ -14,14 +10,14 @@ func GetZentaoSettings() {
...
@@ -14,14 +10,14 @@ func GetZentaoSettings() {
entityType
:=
config
.
EntityType
entityType
:=
config
.
EntityType
entityVal
:=
config
.
EntityVal
entityVal
:=
config
.
EntityVal
requestObj
:=
make
(
map
[
string
]
string
)
requestObj
:=
make
(
map
[
string
]
interface
{}
)
requestObj
[
"entityType"
]
=
entityType
requestObj
[
"entityType"
]
=
entityType
requestObj
[
"entityVal"
]
=
entityVal
requestObj
[
"entityVal"
]
=
entityVal
url
:=
config
.
Url
//
url := config.Url
url
=
commonUtils
.
UpdateUrl
(
url
)
//
url = commonUtils.UpdateUrl(url)
_
,
_
=
httpClient
.
Post
(
url
+
constant
.
UrlZentaoSettings
,
requestObj
)
//_, _ = httpClient.PostJson
(url+constant.UrlZentaoSettings, requestObj)
print2
.
PrintToCmd
(
url
+
constant
.
UrlZentaoSettings
)
//
print2.PrintToCmd(url + constant.UrlZentaoSettings)
//if err == nil {
//if err == nil {
// if pass {
// if pass {
...
...
src/service/testing/result.go
浏览文件 @
f85103c1
...
@@ -2,56 +2,76 @@ package testingService
...
@@ -2,56 +2,76 @@ package testingService
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"github.com/easysoft/zentaoatf/src/model"
httpClient
"github.com/easysoft/zentaoatf/src/service/client"
httpClient
"github.com/easysoft/zentaoatf/src/service/client"
"github.com/easysoft/zentaoatf/src/utils/common
"
scriptService
"github.com/easysoft/zentaoatf/src/service/script
"
config
2
"github.com/easysoft/zentaoatf/src/utils/config"
config
Utils
"github.com/easysoft/zentaoatf/src/utils/config"
constant
"github.com/easysoft/zentaoatf/src/utils/const"
constant
"github.com/easysoft/zentaoatf/src/utils/const"
print2
"github.com/easysoft/zentaoatf/src/utils/print"
fileUtils
"github.com/easysoft/zentaoatf/src/utils/file"
"path"
printUtils
"github.com/easysoft/zentaoatf/src/utils/print"
"github.com/easysoft/zentaoatf/src/utils/vari"
"os"
"strconv"
"strconv"
"strings"
"strings"
)
)
func
SubmitResult
(
caseList
[]
string
)
{
func
SubmitResult
(
assert
string
,
date
string
)
{
conf
ig
:=
config2
.
ReadCurrConfig
()
conf
:=
configUtils
.
ReadCurrConfig
()
entityType
:=
config
.
EntityType
report
:=
GetTestTestReportForSubmit
(
assert
,
date
)
entityVal
:=
config
.
EntityVal
requestObj
:=
make
(
map
[
string
]
string
)
for
_
,
cs
:=
range
report
.
Cases
{
requestObj
[
"entityType"
]
=
entityType
id
:=
cs
.
Id
requestObj
[
"entityVal"
]
=
entityVal
runId
:=
cs
.
IdInTask
cases
:=
make
(
map
[
int
]
bool
)
var
uri
string
for
_
,
str
:=
range
caseList
{
if
runId
!=
0
{
// exe case
arr
:=
strings
.
Split
(
str
,
" "
)
uri
=
fmt
.
Sprintf
(
"testtask-runCase-%d-%d-1.json"
,
runId
,
id
)
var
status
bool
}
else
{
// exe task
str
:=
strings
.
ToLower
(
strings
.
TrimSpace
(
arr
[
0
]))
uri
=
fmt
.
Sprintf
(
"testtask-runCase-%d.json"
,
runId
)
if
str
==
"pass"
{
}
status
=
true
requestObj
:=
map
[
string
]
string
{
"case"
:
strconv
.
Itoa
(
id
),
"version"
:
"0"
}
for
_
,
step
:=
range
cs
.
Steps
{
var
stepStatus
string
if
step
.
Status
{
stepStatus
=
constant
.
PASS
.
String
()
}
else
{
}
else
{
status
=
false
stepStatus
=
constant
.
FAIL
.
String
()
}
}
caseStr
:=
commonUtils
.
Base
(
strings
.
TrimSpace
(
arr
[
1
]))
stepResults
:=
""
name
:=
strings
.
Replace
(
caseStr
,
path
.
Ext
(
caseStr
),
""
,
-
1
)
for
_
,
checkpoint
:=
range
step
.
CheckPoints
{
caseIdStr
:=
strings
.
Split
(
name
,
"-"
)[
1
]
stepResults
+=
checkpoint
.
Actual
// strconv.FormatBool(checkpoint.Status) + ": " + checkpoint.Actual
caseId
,
_
:=
strconv
.
Atoi
(
caseIdStr
)
}
cases
[
caseId
]
=
status
requestObj
[
"steps["
+
strconv
.
Itoa
(
step
.
Id
)
+
"]"
]
=
stepStatus
requestObj
[
"reals["
+
strconv
.
Itoa
(
step
.
Id
)
+
"]"
]
=
stepResults
}
}
//requestObj["cases"] = cases
reqStr
,
_
:=
json
.
Marshal
(
requestObj
)
reqStr
,
_
:=
json
.
Marshal
(
requestObj
)
print2
.
PrintToCmd
(
string
(
reqStr
))
printUtils
.
PrintToCmd
(
string
(
reqStr
))
url
:=
conf
.
Url
+
uri
_
,
ok
:=
httpClient
.
PostStr
(
url
,
requestObj
)
if
ok
{
printUtils
.
PrintToCmd
(
fmt
.
Sprintf
(
"success to submit the results for case %d"
,
id
))
}
}
}
func
GetTestTestReportForSubmit
(
assert
string
,
date
string
)
model
.
TestReport
{
mode
,
name
:=
scriptService
.
GetRunModeAndName
(
assert
)
resultPath
:=
vari
.
Prefer
.
WorkDir
+
constant
.
LogDir
+
scriptService
.
LogFolder
(
mode
,
name
,
date
)
+
string
(
os
.
PathSeparator
)
+
"result.json"
content
:=
fileUtils
.
ReadFile
(
resultPath
)
content
=
strings
.
Replace
(
content
,
"
\n
"
,
""
,
-
1
)
url
:=
config
.
Url
var
report
model
.
TestReport
url
=
commonUtils
.
UpdateUrl
(
url
)
json
.
Unmarshal
([]
byte
(
content
),
&
report
)
_
,
_
=
httpClient
.
Post
(
url
+
constant
.
UrlSubmitResult
,
requestObj
)
//if err == nil {
return
report
// if pass {
// utils.PrintToCmd("success to submit the results")
// }
//}
}
}
src/service/zentao/account.go
浏览文件 @
f85103c1
...
@@ -16,7 +16,7 @@ func Login(baseUrl string, account string, password string) {
...
@@ -16,7 +16,7 @@ func Login(baseUrl string, account string, password string) {
params
[
"account"
]
=
account
params
[
"account"
]
=
account
params
[
"password"
]
=
password
params
[
"password"
]
=
password
_
,
ok
:=
client
.
Post
(
url
,
params
)
_
,
ok
:=
client
.
Post
Str
(
url
,
params
)
if
ok
{
if
ok
{
fmt
.
Println
(
"succes to login"
)
fmt
.
Println
(
"succes to login"
)
}
else
{
}
else
{
...
...
src/service/zentao/testcase.go
浏览文件 @
f85103c1
...
@@ -63,7 +63,7 @@ func ListCaseByTask(baseUrl string, taskId string) []model.TestCase {
...
@@ -63,7 +63,7 @@ func ListCaseByTask(baseUrl string, taskId string) []model.TestCase {
func
GetCaseById
(
baseUrl
string
,
caseId
string
)
model
.
TestCase
{
func
GetCaseById
(
baseUrl
string
,
caseId
string
)
model
.
TestCase
{
params
:=
[][]
string
{{
"caseID"
,
caseId
}}
params
:=
[][]
string
{{
"caseID"
,
caseId
}}
url
:=
baseUrl
+
zentaoUtils
.
GenSuperApiUri
(
"testcase"
,
"getById"
,
params
)
url
:=
baseUrl
+
zentaoUtils
.
GenSuperApiUri
(
"testcase"
,
"getById"
,
params
)
dataStr
,
ok
:=
client
.
Post
(
url
,
nil
)
dataStr
,
ok
:=
client
.
Post
Str
(
url
,
nil
)
if
ok
{
if
ok
{
var
tc
model
.
TestCase
var
tc
model
.
TestCase
...
...
src/test.go
已删除
100644 → 0
浏览文件 @
2ec6d995
package
main
func
main
()
{
}
src/test/submitResult.go
0 → 100644
浏览文件 @
f85103c1
package
main
import
(
testingService
"github.com/easysoft/zentaoatf/src/service/testing"
zentaoService
"github.com/easysoft/zentaoatf/src/service/zentao"
)
func
main
()
{
zentaoService
.
Login
(
"http://ztpmp.ngtesting.org/"
,
"admin"
,
"P2ssw0rd"
)
testingService
.
SubmitResult
(
"scripts/all.suite"
,
"2019-08-14T125610"
)
}
src/ui/pageTestResult.go
浏览文件 @
f85103c1
...
@@ -65,7 +65,7 @@ func selectResultEvent(g *gocui.Gui, v *gocui.View) error {
...
@@ -65,7 +65,7 @@ func selectResultEvent(g *gocui.Gui, v *gocui.View) error {
line
,
_
:=
GetSelectedLine
(
v
,
".*"
)
line
,
_
:=
GetSelectedLine
(
v
,
".*"
)
CurrResult
=
line
CurrResult
=
line
content
:=
scriptService
.
GetTestResult
(
CurrAsset
,
line
)
content
:=
scriptService
.
GetTestResult
ForDisplay
(
CurrAsset
,
line
)
panelCaseList
,
_
:=
g
.
View
(
"panelCaseList"
)
panelCaseList
,
_
:=
g
.
View
(
"panelCaseList"
)
panelCaseList
.
Clear
()
panelCaseList
.
Clear
()
...
@@ -107,9 +107,7 @@ func clearPanelCaseResult() {
...
@@ -107,9 +107,7 @@ func clearPanelCaseResult() {
}
}
func
toUploadResult
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
func
toUploadResult
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
caseList
:=
scriptService
.
GetTestResult
(
CurrAsset
,
CurrResult
)
testingService
.
SubmitResult
(
CurrAsset
,
CurrResult
)
testingService
.
SubmitResult
(
caseList
)
return
nil
return
nil
}
}
...
...
src/utils/const/enum.go
浏览文件 @
f85103c1
...
@@ -41,17 +41,21 @@ const (
...
@@ -41,17 +41,21 @@ const (
PASS
ResultStatus
=
iota
PASS
ResultStatus
=
iota
FAIL
FAIL
SKIP
SKIP
BLOCKED
)
)
func
(
c
ResultStatus
)
String
()
string
{
func
(
c
ResultStatus
)
String
()
string
{
switch
c
{
switch
c
{
case
PASS
:
case
PASS
:
return
"
PASS
"
return
"
pass
"
case
FAIL
:
case
FAIL
:
return
"
FAIL
"
return
"
fail
"
case
SKIP
:
case
SKIP
:
return
"SKIP"
return
"n/a"
case
BLOCKED
:
return
"blocked"
}
}
return
"UNKNOWN"
return
"UNKNOWN"
}
}
...
...
src/utils/print/print.go
浏览文件 @
f85103c1
...
@@ -28,6 +28,10 @@ func PrintSample() {
...
@@ -28,6 +28,10 @@ func PrintSample() {
}
}
func
PrintToSide
(
msg
string
)
{
func
PrintToSide
(
msg
string
)
{
if
!
vari
.
RunFromCui
{
fmt
.
Println
(
msg
)
return
}
slideView
,
_
:=
vari
.
Cui
.
View
(
"side"
)
slideView
,
_
:=
vari
.
Cui
.
View
(
"side"
)
slideView
.
Clear
()
slideView
.
Clear
()
...
@@ -35,6 +39,10 @@ func PrintToSide(msg string) {
...
@@ -35,6 +39,10 @@ func PrintToSide(msg string) {
}
}
func
PrintToMainNoScroll
(
msg
string
)
{
func
PrintToMainNoScroll
(
msg
string
)
{
if
!
vari
.
RunFromCui
{
fmt
.
Println
(
msg
)
return
}
mainView
,
_
:=
vari
.
Cui
.
View
(
"main"
)
mainView
,
_
:=
vari
.
Cui
.
View
(
"main"
)
mainView
.
Clear
()
mainView
.
Clear
()
...
@@ -42,6 +50,10 @@ func PrintToMainNoScroll(msg string) {
...
@@ -42,6 +50,10 @@ func PrintToMainNoScroll(msg string) {
}
}
func
PrintToCmd
(
msg
string
)
{
func
PrintToCmd
(
msg
string
)
{
if
!
vari
.
RunFromCui
{
fmt
.
Println
(
msg
)
return
}
cmdView
,
_
:=
vari
.
Cui
.
View
(
"cmd"
)
cmdView
,
_
:=
vari
.
Cui
.
View
(
"cmd"
)
_
,
_
=
fmt
.
Fprintln
(
cmdView
,
msg
)
_
,
_
=
fmt
.
Fprintln
(
cmdView
,
msg
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录