提交 8c4fa216 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix a issue

上级 737faca9
......@@ -22,8 +22,8 @@ $>ztf.exe junit -p 1 mvn clean package test 执行junit单元测试脚
更多请参照https://www.ztesting.net/book/ztf-doc/junit-33.html
$>ztf.exe ci product01\tc-1.py 将脚本里修改的用例信息,同步到禅道系统。
$>ztf.exe cr log\001 提交测试结果到禅道系统
$>ztf.exe cr -r log\001 提交测试结果到禅道系统,不需要逐个确认。
$>ztf.exe cr log\001 -p 1 提交测试结果到禅道系统编号为1的产品
$>ztf.exe cr log\001 -p 1 -t 1 -y 提交测试结果到禅道系统。使用-t提供TaskID、或-y忽略确认时,不需要确认。
$>ztf.exe cb log\001 提交测试结果中失败用例为缺陷。
$>ztf.exe list demo\lang\bat 列出目录bat下的所有脚本文件,支持多个目录和文件参数项。
......
......@@ -6,7 +6,7 @@ import (
stdinUtils "github.com/easysoft/zentaoatf/src/utils/stdin"
)
func CommitZTFTestResult(files []string, noNeedConfirm bool) {
func CommitZTFTestResult(files []string, productId string, taskId string, noNeedConfirm bool) {
var resultDir string
if len(files) > 0 {
resultDir = files[0]
......@@ -15,5 +15,5 @@ func CommitZTFTestResult(files []string, noNeedConfirm bool) {
}
resultDir = fileUtils.UpdateDir(resultDir)
zentaoService.CommitZTFTestResult(resultDir, noNeedConfirm)
zentaoService.CommitZTFTestResult(resultDir, productId, taskId, noNeedConfirm)
}
......@@ -35,17 +35,6 @@ func Get(url string) (string, bool) {
return "", false
}
//req.Header.Set("cookie", vari.SessionVar+"="+vari.SessionId)
//
//q := req.URL.Query()
//q.Add(vari.SessionVar, vari.SessionId)
//if params != nil {
// for pkey, pval := range params {
// q.Add(pkey, pval)
// }
//}
//req.URL.RawQuery = q.Encode()
resp, respErr := client.Do(req)
if respErr != nil {
if vari.Verbose {
......
......@@ -11,6 +11,7 @@ import (
"github.com/easysoft/zentaoatf/src/utils/vari"
"github.com/fatih/color"
"github.com/mattn/go-runewidth"
"strconv"
"strings"
"time"
)
......@@ -108,7 +109,7 @@ func GenZTFTestReport(report model.TestReport, pathMaxWidth int) {
))
//println("===" + vari.LogDir)
report.ProductId, _ = strconv.Atoi(vari.ProductId)
json, _ := json.Marshal(report)
fileUtils.WriteFile(vari.LogDir+"result.json", string(json))
}
......@@ -16,12 +16,12 @@ import (
)
func CommitTestResult(report model.TestReport, testTaskId int) {
if len(report.FuncResult) > 0 && vari.ProductId == "" {
vari.ProductId = strconv.Itoa(report.FuncResult[0].ProductId)
}
//if len(report.FuncResult) > 0 && vari.ProductId == "" {
// vari.ProductId = strconv.Itoa(report.FuncResult[0].ProductId)
//}
if vari.ProductId == "" {
logUtils.Screen(i118Utils.I118Prt.Sprintf("ignore_to_submit_result"))
logUtils.Screen(color.CyanString(i118Utils.I118Prt.Sprintf("ignore_to_submit_result")))
return
}
......
......@@ -5,19 +5,26 @@ import (
configUtils "github.com/easysoft/zentaoatf/src/utils/config"
i118Utils "github.com/easysoft/zentaoatf/src/utils/i118"
stdinUtils "github.com/easysoft/zentaoatf/src/utils/stdin"
"github.com/easysoft/zentaoatf/src/utils/vari"
"strconv"
)
func CommitZTFTestResult(resultDir string, noNeedConfirm bool) {
func CommitZTFTestResult(resultDir string, productId string, taskId string, noNeedConfirm bool) {
conf := configUtils.ReadCurrConfig()
Login(conf.Url, conf.Account, conf.Password)
report := testingService.GetZTFTestReportForSubmit(resultDir)
task := stdinUtils.GetInput("\\d*", "",
i118Utils.I118Prt.Sprintf("pls_enter") + " " + i118Utils.I118Prt.Sprintf("task_id")+
i118Utils.I118Prt.Sprintf("task_id_empty_to_create"))
if vari.ProductId == "" && productId != "" {
vari.ProductId = productId
}
testTask, _ := strconv.Atoi(task)
CommitTestResult(report, testTask)
if taskId == "" && !noNeedConfirm {
taskId = stdinUtils.GetInput("\\d*", "",
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("task_id")+
i118Utils.I118Prt.Sprintf("task_id_empty_to_create"))
}
taskIdInt, _ := strconv.Atoi(taskId)
CommitTestResult(report, taskIdInt)
}
\ No newline at end of file
......@@ -104,7 +104,7 @@ func main() {
case "cr":
files := fileUtils.GetFilesFromParams(os.Args[2:])
if err := flagSet.Parse(os.Args[len(files)+2:]); err == nil {
action.CommitZTFTestResult(files, noNeedConfirm)
action.CommitZTFTestResult(files, productId, taskId, noNeedConfirm)
}
case "cb":
......@@ -158,7 +158,7 @@ func main() {
func run(args []string) {
if len(args) >= 3 && stringUtils.FindInArr(args[2], constant.UnitTestType) { // unit test
// junit -p 1 mvn clean package test
// junit -p 1 mvn clean package test
vari.UnitTestType = args[2]
end := 8
if end > len(args) - 1 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册